mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-24 02:31:18 -08:00
Proxies only serve /healthz, which reports whether the node has a tailnet IP, so it can't back a liveness or readiness probe. When TS_ENABLE_HEALTH_CHECK is set, containerboot now also serves /livez, which fails only when tailscaled stops answering LocalAPI, and /readyz, which passes once the node has tailnet IPs and, with TS_SERVE_CONFIG set, has applied the serve config and has a cert for each HTTPS-only Tailscale Service it advertises. Certs are checked through the read-only cert-status endpoint so the probe never triggers issuance. An expired or unreadable cert counts as present, as failing readiness on it would stop a StatefulSet rollout before it reaches the replica that renews certs. Updates tailscale/corp#38175 Signed-off-by: chaosinthecrd <[email protected]>
25 lines
732 B
Go
25 lines
732 B
Go
// Copyright (c) Tailscale Inc & contributors
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
//go:build !plan9
|
|
|
|
package health
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"tailscale.com/types/logger"
|
|
)
|
|
|
|
// RegisterLivezHandlers registers a liveness probe at /livez, which fails so
|
|
// that Kubernetes restarts the container. Only register checks for states a
|
|
// restart fixes: a proxy that has lost its connection to control, or is
|
|
// waiting for the operator to issue a new auth key, is still live. Register
|
|
// every check on the returned Probe before serving mux, as a Probe with no
|
|
// checks passes.
|
|
func RegisterLivezHandlers(mux *http.ServeMux, logf logger.Logf) *Probe {
|
|
p := &Probe{name: "livez", logf: logf}
|
|
mux.Handle("GET /livez", p)
|
|
return p
|
|
}
|