Each probe answers a different question. Get them wrong and healthy pods get restarted.
Three probes, three jobs
| Probe | Question it answers | On failure |
|---|---|---|
startupProbe | Has the app finished booting? | the container is killed and restarted |
livenessProbe | Is the process stuck beyond repair? | the container is restarted |
readinessProbe | Should it receive traffic right now? | the pod stops receiving Service traffic, with no restart |
While a startup probe is configured and hasn't succeeded, the kubelet runs neither the liveness nor the readiness probe. After that, liveness and readiness run on their own schedules for the pod's whole life.
Defaults worth knowing
| Field | Default |
|---|---|
initialDelaySeconds | 0 |
periodSeconds | 10 |
timeoutSeconds | 1 |
failureThreshold | 3 |
successThreshold | 1 (must be 1 for liveness and startup) |
A 1-second timeout is tight for an endpoint that touches disk or a database. A slow probe counts as a failure.
A sane setup
startupProbe:
httpGet: { path: /livez, port: 8080 }
periodSeconds: 10
failureThreshold: 30 # up to ~300s to boot
livenessProbe:
httpGet: { path: /livez, port: 8080 } # process-only check
periodSeconds: 10
failureThreshold: 3
readinessProbe:
httpGet: { path: /readyz, port: 8080 } # can it serve a request now?
periodSeconds: 5
failureThreshold: 2Probe types are httpGet (any status from 200 to 399 passes), tcpSocket, exec (exit code 0 passes) and grpc.
Debug commands
kubectl describe pod <pod> # Events: 'Liveness probe failed', 'Readiness probe failed'
kubectl get pod <pod> -o jsonpath='{.status.containerStatuses[*].restartCount}'
kubectl get endpointslices -l kubernetes.io/service-name=<svc>
kubectl exec <pod> -- wget -qO- http://127.0.0.1:8080/readyzIf Events show Liveness probe failed and then Killing, the kubelet restarted the container because of the probe. The app didn't crash on its own.
Gotchas
- The probe connects to the pod IP, so an app bound to
127.0.0.1failshttpGetandtcpSocketprobes. - Under CPU throttling, a 1-second
timeoutSecondsmakes a healthy app fail its probes. - A rolling update waits for readiness. New pods that never become Ready stall the rollout, which protects you.
execprobes start a process in the container on every check. Running them every second is expensive.
Common wrong fix
Deleting the liveness probe because it keeps restarting pods. That turns a visible problem into a silent one, and a deadlocked process now sits in rotation until someone notices. Find out why the probe fails: a slow boot needs a startupProbe, a slow endpoint needs a cheaper check or a longer timeout, and a dependency check belongs in readiness, not liveness.