Configure liveness and readiness probes
A ProxyClass can turn on Kubernetes liveness and readiness probes for proxies in ProxyGroups of all resource types. These probe settings do not apply to standalone proxies or the proxies of Connector and PeerRelay resources. Probes require the Tailscale Kubernetes Operator version 1.106 or later.
Both probes are off by default. Proxy images earlier than version 1.106 don't serve the /livez and /readyz endpoints. With those images, a liveness probe keeps failing, so Kubernetes restarts the proxy repeatedly. A readiness probe never passes.
What the probes check
Each probe checks one of the health check endpoints that the Tailscale container serves:
livenessProbechecks/livez, which fails whentailscaledstops responding but not when the proxy can't reach the tailnet. Kubernetes restarts the container when this probe fails.readinessProbechecks/readyz, which passes when the proxy has at least one Tailscale IP address. OningressProxyGroupproxies,/readyzalso waits until the proxy applies its Serve configuration. It also waits until the proxy has a TLS certificate for each HTTPS-only Tailscale Service that it advertises. Kubernetes doesn't count the pod as ready until this probe passes. During a rolling update, Kubernetes waits for each new replica to pass this probe before it replaces the next one.
Without the readiness probe, an ingress or kube-apiserver ProxyGroup pod counts as ready as soon as its container starts, even if it can't route traffic yet. With or without the probe, egress ProxyGroup pods don't count as ready until the operator confirms that cluster traffic for each egress Service routes to them.
Turn on probes
To turn on a probe, set livenessProbe or readinessProbe under spec.statefulSet.pod.tailscaleContainer in a ProxyClass, then apply the ProxyClass to a ProxyGroup. The following example turns on the liveness probe with the default values and sets the readiness probe to run every 5 seconds:
apiVersion: tailscale.com/v1alpha1
kind: ProxyClass
metadata:
name: prod-proxies
spec:
statefulSet:
pod:
tailscaleContainer:
livenessProbe: {}
readinessProbe:
periodSeconds: 5
An empty object ({}) turns on a probe with the default values. Each probe accepts the following optional fields:
| Field | Default | Description |
|---|---|---|
initialDelaySeconds | 0 | The number of seconds after the container starts and before the first probe. |
periodSeconds | 10 | The number of seconds between probes. |
timeoutSeconds | 5 for livenessProbe, 1 for readinessProbe | The number of seconds before a probe times out. |
failureThreshold | 3 | The number of consecutive failed checks before Kubernetes treats the probe as failed. |
Ports and environment variables
On ingress and egress ProxyGroup proxies, when either probe is on, the operator sets TS_ENABLE_HEALTH_CHECK to true on the Tailscale container and configures the probes to use the port in TS_LOCAL_ADDR_PORT, which is 9002 by default. If the ProxyClass also sets environment variables that stop Kubernetes from reaching the endpoints, the ProxyGroup reports a ProxyGroupInvalid status. For example, this happens if the ProxyClass sets TS_ENABLE_HEALTH_CHECK to false, sets TS_LOCAL_ADDR_PORT to a loopback address, or sets the deprecated TS_HEALTHCHECK_ADDR_PORT. The proxies of kube-apiserver ProxyGroup resources always serve the endpoints on port 9002 and ignore these environment variables.