bind health listeners to the pod's loopback and probe them by exec
This commit is contained in:
parent
448c3bf1b3
commit
9c64b80538
1 changed files with 255 additions and 185 deletions
|
|
@ -142,18 +142,24 @@ credential directory.
|
|||
a listener and `egress` (`swarm-logs-auth`, `swarm-metrics-auth`) has the one policy: it admits the
|
||||
node to the listener and nothing else, and allows the egress above.
|
||||
- **Probes:** a service with an opt-in health listener gets its variable set to
|
||||
`0.0.0.0:8080`, with liveness on `/healthz` and readiness on `/readyz`
|
||||
(see [Readiness checks](../swarm/readiness.md)). `swarm-controller` is one of
|
||||
`127.0.0.1:8080`, with liveness on `/healthz` and readiness on `/readyz`
|
||||
(see [Readiness checks](../swarm/readiness.md)). The kubelet's `httpGet`
|
||||
probes dial the pod's IP, so these are `exec` probes: each runs `wget` from
|
||||
the image (`wgetOnly`, in `nix/images/default.nix`) against the loopback URL
|
||||
in the container, with a 5-second timeout, and a 503 fails it. The pod
|
||||
declares no port for the listener. `swarm-controller` is one of
|
||||
them, with `SWARM_CONTROLLER_HEALTH_ADDR`. A third-party daemon with no health variable,
|
||||
`victoria-logs` and `victoria-metrics`, names a `probe` path instead (`/health`), which both probes
|
||||
request on its listener. A `startupFailureThreshold` in it (`victoria-metrics`, 60) adds a
|
||||
startup probe on the same path, tried every ten seconds, before the other two begin. The health port takes no credential, because the
|
||||
kubelet's probes carry none and the routes answer a status code with no body.
|
||||
Only the node reaches it, through the namespace's default-deny
|
||||
ingress policy and the pod's own policy, which admit no other pod and no
|
||||
client of the bridge. The port is an exception to mara's ruling ("if you can reach
|
||||
it, even just in the cluster, it needs auth"): the kubelet has no credential
|
||||
to send.
|
||||
startup probe on the same path, tried every ten seconds, before the other two begin.
|
||||
The health listener of our own daemons is unreachable from outside the pod: the
|
||||
node, other pods and the bridge get a refusal, so it needs no credential.
|
||||
The one health route outside the pod is the `/health` of `victoria-logs` and
|
||||
`victoria-metrics` on their main port. Upstream answers `/health`, `/ping`,
|
||||
`/-/healthy` and `/-/ready` before it checks `-httpAuth`, and the gateway needs
|
||||
the main port on the pod's IP, so no bind or probe can close it. It's
|
||||
reachable from the node only, through the default-deny ingress policy, and it
|
||||
returns a status and no data.
|
||||
- **Listener and init container:** a service with a TCP `listener`
|
||||
(`swarm-controller`, with `swarm.controller.tcp.enable`) publishes its port
|
||||
with a ClusterIP Service, admits only the node to it with a NetworkPolicy, and
|
||||
|
|
|
|||
Loading…
Reference in a new issue