Use ProxyClass for proxy customization

Last validated:

A ProxyClass is a cluster-scoped custom resource that lets you customize the proxies (standalone or ProxyGroup) that the Tailscale Kubernetes Operator creates.

By default, the operator creates proxies with a standard configuration. A ProxyClass provides a mechanism to configure these proxies, letting you:

  • Customize the proxy's StatefulSet (pod/container spec, pod placement, security contexts, labels, annotations, and more).
  • Configure static endpoints that use NodePort Service resources, so tailnet devices can connect directly to ProxyGroup and Connector proxies.
  • Enable metrics collection and Prometheus integration through ServiceMonitor.
  • Turn on liveness and readiness probes for ProxyGroup proxies.
  • Configure Tailscale-specific settings.

Example

The following example adds specific team labels to the proxy pods:

apiVersion: tailscale.com/v1alpha1
kind: ProxyClass
metadata:
  name: prod-proxies
spec:
  statefulSet:
    pod:
      labels:
        team: eng
        environment: prod

How to apply a ProxyClass

You can link a ProxyClass to your Tailscale resources by adding an annotation or setting a field in the resource spec:

  • For a Kubernetes Ingress or Service, add the tailscale.com/proxy-class annotation:

    metadata:
      annotations:
        tailscale.com/proxy-class: prod-proxies
    
  • For a Connector or ProxyGroup, set the spec.proxyClass field:

    spec:
      proxyClass: prod-proxies
    

Default ProxyClass

If a ProxyGroup doesn't have a ProxyClass explicitly assigned, the operator can automatically apply a default ProxyClass to it. The operator does the same for the proxy of a single Kubernetes Ingress or Service. To configure a default ProxyClass:

  • Helm: Set the proxyConfig.defaultProxyClass value.
  • Environment variable: Set PROXY_DEFAULT_CLASS on the Operator.

The operator does not apply the default ProxyClass to a Connector or a PeerRelay. To use a ProxyClass with these resources, set their spec.proxyClass field.

Further exploration

  • Configure high availability by using a ProxyClass to set topology spreading, resource limits, and metrics for production deployments.