You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FR: Specifying node selector for k8s operator proxy pods #9062
When I tag a service to be available in tailscale it creates a stateful set to handle the proxying. Sadly this proxy doesn't come with any node selectors available so AKS tries to start it on the windows node I have in my cluster. This ofcause doesn't work.
I can't manually add in the node selector due to how Tailscale operates with the kubernetes api, since it overwrites any changes done manually.
How should we solve this?
At the very least adding a default node selector of kubernetes.io/os=linux would at least allow tailscale to start. But even better i would like to be able to actually control what the node selector actually is, so i can ensure that tailscale is at least running somewhat close to the service it's going to be talking to.
What is the impact of not solving this?
I think i can workaround it by applying a taint to the windows node, but that means i have to modify all my windows workloads to have a toleration to that taint.
Anything else?
I wasn't entirely sure if this should be considered a bug.
Reacted by mrkwtz, Jake Edgington and Gabriel Martinez
What if we just remove the embedded proxy.yaml file from the operator binary and include it in the container at a path that users can override via ConfigMap?
I've started working on a Helm chart for the operator -- it could reuse some of the relevant podSpecTemplate fragments to simplify tweaking things on the proxy StatefulSet like annotations, nodeSelectors, tolerations, etc.
What if we just remove the embedded proxy.yaml file from the operator binary and include it in the container at a path that users can override via ConfigMap?
that sgtm, we would need to move some of the fields that are set there (like initContainers) to be set by the operator
What if we just remove the embedded proxy.yaml file from the operator binary and include it in the container at a path that users can override via ConfigMap?
I've started working on a Helm chart for the operator -- it could reuse some of the relevant podSpecTemplate fragments to simplify tweaking things on the proxy StatefulSet like annotations, nodeSelectors, tolerations, etc.
Then we just mount proxy.yaml somewhere in the operator container filesystem. Add another argument to the operator to specify the filepath of the proxy template.
On the helm side, we can provide some guardrails that make it behave like any other podSpecTemplate.
Just to ask a stupid question which I assume has already been discussed to death somewhere: have you considered using some Custom Kubernetes resources for managing what the operator does rather than trying to layer it on top of existing resources? Or at least an addition to annotations if advanced control is required?
I imagine there might be use-cases where controlling the proxy location by service might be beneficial, for example to co-locate it with the pods it is servicing. (Not required to solve my problem adequately, just as a thought?)
On the other hand, I love the simplicity of just adding a couple of annotations and then things just work.
Just to ask a stupid question which I assume has already been discussed to death somewhere: have you considered using some Custom Kubernetes resources for managing what the operator does rather than trying to layer it on top of existing resources? Or at least an addition to annotations if advanced control is required?
I imagine there might be use-cases where controlling the proxy location by service might be beneficial, for example to co-locate it with the pods it is servicing. (Not required to solve my problem adequately, just as a thought?)
On the other hand, I love the simplicity of just adding a couple of annotations and then things just work.
Please take this with a grain of salt -- I don't work at Tailscale, I'm just some random guy...
I prefer to stick with annotations until I understand more of the usage patterns and an API starts to emerge. If you go down the CRD path prematurely, you can end up locking a major version into something that isn't a great fit for some of the use cases you uncover along the way.
We annotate services on k8s to make the tailscale-operator create the resources, the proxy pod created by the operator will sit on a different namespace than the resource. When using network policies and automation, we need to have predictive behaviour so we can configure the access between the proxy pod and the actual workload. The operator currently labels the tailscale statefulset pod with something like this:
None of this can be inferred from any existing configuration before the service is created, and waiting to get this information after the resource is created is not something we want to rely on.
So, ideally the proxy could be customised further, either by adding a CRD with base templates, through extra tags for individual componentes (doesn't scale very well) or with a single tag that would be used as a cumulative template to the default one.
We are planning to eventually add more customization options to ProxyClass.
Feedback on whether it fits your workflow + what other fields you might need to configure (and why) is very welcome.
We are planning to eventually add more customization options to ProxyClass. Feedback on whether it fits your workflow + what other fields you might need to configure (and why) is very welcome.
Hi @irbekrm, thank you for checking 😄 Unfortunately we're not using the Ingress feature. We're only using annotated services to create tailscale proxies automatically with the k8s-operator. This is mostly because we have also TCP services and we are using the same logic to expose on all of them.
@GMartinez-SistiProxyClass works with Services. You can set tailscale.com/proxy-class=<proxy-class-name> label on a Service to refer to a ProxyClass.
Then it should cover our use cases since we can use labels for the network policies/discovery 🌟 . I thought this was just for Ingress services, maybe the class term threw me off 😅. Thanks!
Activity
jakedgy commentedon Aug 29, 2023
What if we just remove the embedded proxy.yaml file from the operator binary and include it in the container at a path that users can override via ConfigMap?
I've started working on a Helm chart for the operator -- it could reuse some of the relevant
podSpecTemplatefragments to simplify tweaking things on the proxy StatefulSet like annotations, nodeSelectors, tolerations, etc.maisem commentedon Aug 29, 2023
that sgtm, we would need to move some of the fields that are set there (like initContainers) to be set by the operator
zlepper commentedon Aug 30, 2023
That would certainly solve the issue I have :)
jakedgy commentedon Sep 1, 2023
@maisem I propose we just use a ConfigMap with the proxy skeleton as data:
Then we just mount
proxy.yamlsomewhere in the operator container filesystem. Add another argument to the operator to specify the filepath of the proxy template.On the helm side, we can provide some guardrails that make it behave like any other podSpecTemplate.
If we add Kustomize support, we could start with a default base, a userspace mode overlay, and users can just add their own overlays as needed.
zlepper commentedon Sep 1, 2023
Just to ask a stupid question which I assume has already been discussed to death somewhere: have you considered using some Custom Kubernetes resources for managing what the operator does rather than trying to layer it on top of existing resources? Or at least an addition to annotations if advanced control is required?
I imagine there might be use-cases where controlling the proxy location by service might be beneficial, for example to co-locate it with the pods it is servicing. (Not required to solve my problem adequately, just as a thought?)
On the other hand, I love the simplicity of just adding a couple of annotations and then things just work.
jakedgy commentedon Sep 1, 2023
Please take this with a grain of salt -- I don't work at Tailscale, I'm just some random guy...
I prefer to stick with annotations until I understand more of the usage patterns and an API starts to emerge. If you go down the CRD path prematurely, you can end up locking a major version into something that isn't a great fit for some of the use cases you uncover along the way.
jakedgy commentedon Sep 4, 2023
Taking a stab at a Helm Chart in #9224.
I still need to get the ConfigMap built for the proxy template, but the idea is that it will follow the same pod syntax pattern
.Values.operator.GMartinez-Sisti commentedon Nov 9, 2023
I'm also blocked by something similar to this.
We annotate services on k8s to make the tailscale-operator create the resources, the proxy pod created by the operator will sit on a different namespace than the resource. When using network policies and automation, we need to have predictive behaviour so we can configure the access between the proxy pod and the actual workload. The operator currently labels the tailscale statefulset pod with something like this:
None of this can be inferred from any existing configuration before the service is created, and waiting to get this information after the resource is created is not something we want to rely on.
So, ideally the proxy could be customised further, either by adding a CRD with base templates, through extra tags for individual componentes (doesn't scale very well) or with a single tag that would be used as a cumulative template to the default one.
irbekrm commentedon Feb 23, 2024
Node selectors and other customization for proxy resources can now (v1.60) be applied via a ProxyClass custom resource https://tailscale.com/kb/1236/kubernetes-operator#cluster-resource-customization-using-proxyclass-custom-resource.
We are planning to eventually add more customization options to ProxyClass.
Feedback on whether it fits your workflow + what other fields you might need to configure (and why) is very welcome.
GMartinez-Sisti commentedon Feb 26, 2024
Hi @irbekrm, thank you for checking 😄 Unfortunately we're not using the Ingress feature. We're only using annotated services to create tailscale proxies automatically with the k8s-operator. This is mostly because we have also TCP services and we are using the same logic to expose on all of them.
irbekrm commentedon Feb 26, 2024
@GMartinez-Sisti
ProxyClassworks withServices. You can settailscale.com/proxy-class=<proxy-class-name>label on aServiceto refer to aProxyClass.GMartinez-Sisti commentedon Feb 26, 2024
Then it should cover our use cases since we can use labels for the network policies/discovery 🌟 . I thought this was just for Ingress services, maybe the
classterm threw me off 😅. Thanks!irbekrm commentedon Feb 26, 2024
Yeah the name is inspired from
IngressClass, but really there is nothingIngress-specific. Hope it'll work!cmd/k8s-operator,k8s-operator: allow users to configure proxy env var…
irbekrm commentedon Apr 15, 2024
Closing as implemented in #11074