Short answer: readiness pulls traffic, liveness restarts, startup holds the other two back
All three probes check the same way (HTTP, TCP, exec, gRPC); what differs is what the kubelet does on failure. The same slow response can mean "pull this pod for a moment" or "restart every pod", depending on which probe it trips.
Side by side
- readinessProbe — can this pod take requests now? · On failure it leaves the Service endpoints but is not restarted (READY 0/1, RESTARTS unchanged) · Without one, traffic arrives too early
- livenessProbe — is the process stuck? · After
failureThresholdfailures in a row the kubelet restarts the container (RESTARTS goes up) · Get it wrong and you getCrashLoopBackOff - startupProbe — has startup finished? · Holds liveness and readiness back until it passes; if it never does, the container restarts · Without one, a slow app is killed mid-startup
- Defaults —
periodSeconds10,timeoutSeconds1,failureThreshold3,initialDelaySeconds0.httpGetpasses on 200–399.
How it works in practice
startupProbe:
httpGet: { path: /healthz, port: 8080 }
periodSeconds: 5
failureThreshold: 36 # up to 180 s to start
livenessProbe:
httpGet: { path: /healthz, port: 8080 } # the process only
readinessProbe:
httpGet: { path: /ready, port: 8080 } # ready to serve
$ kubectl get pods -n shop
NAME READY STATUS RESTARTS AGE
checkout-7d9f8-x2k1p 0/1 Running 0 6m
checkout-7d9f8-q8w2m 0/1 Running 3 (40s ago) 6m
x2k1p: no restarts but 0/1 — readiness is failing, and its IP is missing from kubectl get endpoints checkout. q8w2m: restarts climbing — the kubelet is killing it. Its Last State is usually Exit Code: 143 (SIGTERM), not OOMKilled.
When to use which
- Any container that serves requests → readiness is effectively required. Rolling updates advance on it.
- Startup takes tens of seconds (JVM, cache warm-up) → startupProbe. With defaults, liveness gives up after about 30 seconds.
- Liveness only if the process can really hang while alive (deadlocks); a crashed process restarts without any probe.
- Shed a pod briefly under overload → readiness. Keep liveness more forgiving.
Incident 1: liveness keeps killing an app that is still starting
Liveness probe failed: Get "http://10.244.3.5:8080/healthz": dial tcp 10.244.3.5:8080: connect: connection refused
Container app failed liveness probe, will be restarted
It appears when startup slows (a fresh node, a bigger cache). If kubectl logs --previous never reaches the "started" line, the app dies before it comes up. Compare initialDelaySeconds + periodSeconds × failureThreshold with the real startup time and add a startupProbe. To sort out restart causes, see the CrashLoopBackOff first-checks guide.
Incident 2: the database goes down and every pod restarts
Liveness probe failed: HTTP probe failed with statuscode: 503
If the liveness /healthz also checks the database, one DB outage restarts every pod at once, and they all reconnect together when it returns. Point liveness at a process-only endpoint and handle dependencies in readiness or in the app's error handling. A shared database in readiness, though, empties the endpoints during an outage.
Incident 3: missing or wrong readiness — 5xx or a stuck rollout
With no readiness, a pod is Ready as soon as it starts, so early requests get 5xx. With a wrong path, new pods never become Ready and the rollout stops.
Readiness probe failed: HTTP probe failed with statuscode: 404
error: deployment "checkout" exceeded its progress deadline
Match the probe path and port to the app; if it is urgent, run kubectl rollout undo. Passing progressDeadlineSeconds (600 seconds by default) does not roll back on its own. If CI was green meanwhile, see GitHub Actions succeeded but the rollout failed.
What not to do
- Raising
initialDelaySecondsto minutes — slower startups still die, and fast ones go unwatched for the rest of the delay.
Summary
- RESTARTS rising → liveness or startup; unchanged but 0/1 → readiness
- Read the event:
connection refused= not up yet,statuscode= path or response,Client.Timeout exceeded=timeoutSeconds - Slow startup → startupProbe; keep dependencies out of liveness
To practise this scene, try Core application restarts endlessly.
Quick diagnostic checklist
- In
kubectl get pods, rising RESTARTS points to liveness or startup; READY 0/1 with no restarts points to readiness. - Find which of the Liveness, Readiness or Startup probes failed in the Events of
kubectl describe pod. connection refusedmeans the app is not up yet or the probe port is wrong.- For
statuscode: 404check the probe path; for 500 or 503 check what the health endpoint tests. - If
Client.Timeout exceededappears only under load, check whether the 1-second defaulttimeoutSecondsis too short. - If
kubectl logs --previousnever shows startup completing, give the app time with a startupProbe. - Make sure the liveness endpoint does not check the database or external APIs.
- Check that a pod failing readiness is missing from
kubectl get endpointsand whetherkubectl rollout statusis stuck.