BlogKubernetes

Kubernetes liveness, readiness, startup probes done right

Stop routing traffic to pods that aren't ready and restarts that make outages worse — the three probes explained.

Jun 24, 2025·4 min readIntermediate·By the SecOpsLog team · command-tested

Kubernetes knows your container process is running. It does not know whether your app can serve traffic, whether it is wedged in a deadlock, or whether it is still warming a 90-second cache. That gap is what probes fill — but only if you pick the right probe for the right job. Readiness gates Service endpoints. Liveness triggers a container restart. Startup delays the other two until a slow-booting process is actually up. Swap readiness and liveness and a database blip becomes a fleet-wide restart.

The rule that saves most teams: readiness may check dependencies; liveness must not. If your liveness handler pings Postgres and Postgres hiccups, kubelet kills every replica at once — a self-inflicted outage that looks like an infrastructure incident. For JVM and .NET apps that need a minute to start, a startup probe prevents liveness from murdering the pod on boot. The Kubernetes administration track walks through probes in the context of rollouts and Service routing.

Three probes, three jobs

Readiness gates traffic. Liveness restarts. Startup holds the other two until the process is actually up.

kubelet runs probes on a schedule 1 Readiness can this pod take traffic? fail → drop from Endpoints no container restart deps / warm caches OK here 2 Liveness is the process deadlocked? fail → kubelet restarts it drops in-flight work never ping shared deps 3 Startup still booting? hold off delays readiness + liveness until success or timeout JVM / .NET slow boots Swap readiness and liveness and a DB blip becomes a fleet-wide restart. separate paths: /ready · /healthz · startupProbe window
Readiness — traffic gate Liveness — restart trigger Startup — boot shield
Probe design checklist

Liveness restarts are expensive. Use them only when the process is truly stuck, not when the world outside is slow.

1Separate paths/ready vs /healthz2Deps only inreadinessnever in liveness3Startup if slowbootfailureThreshold × period4Verify underfailureEndpoints drop, no restart storm

Readiness vs liveness — different consequences

Readiness vs liveness
Readiness
gates Service Endpoints
fail → removed from load balancer
no container restart
check deps + warm caches
Liveness
detects wedged process
fail → kubelet restarts container
disruptive — drops in-flight work
check only local process health

Readiness failing during a rolling update is normal and desirable — the new pod is not ready yet, so traffic stays on the old replicas. Liveness failing during an update is a incident — kubelet keeps restarting the new pod before it ever joins the Service.

deploy-probes.yaml
readinessProbe:
httpGet: { path: /ready, port: 8080 }
periodSeconds: 5
failureThreshold: 3
livenessProbe:
httpGet: { path: /healthz, port: 8080 }
periodSeconds: 10
failureThreshold: 3
timeoutSeconds: 2
Never check dependencies in liveness
If /healthz pings the database, a DB blip restarts every pod at once. Liveness should answer one question: is this process alive and responsive? Dependency checks, cache warm-up, and migration status belong in readiness — or in your app metrics, not in a restart trigger.

Startup probe for slow boots

Without a startup probe, liveness and readiness begin immediately. A JVM that needs 60 seconds to warm will fail liveness three times in 30 seconds and enter CrashLoopBackOff before it ever serves a request. A startup probe tells kubelet: do not run liveness or readiness until this succeeds, or until failureThreshold × periodSeconds elapses.

deploy-startup.yaml
startupProbe:
httpGet: { path: /healthz, port: 8080 }
failureThreshold: 30
periodSeconds: 5 # up to 150s boot window
livenessProbe:
httpGet: { path: /healthz, port: 8080 }
periodSeconds: 10

Verify probe behavior under failure

Test the negative paths deliberately. Block readiness and confirm the pod drops from Endpoints but does not restart. Break liveness locally (not via a shared dependency) and confirm a single restart, not a loop. During rollouts, watch kubectl get endpoints — ready count should climb smoothly, not oscillate.

bash — endpoints follow readinesslive
kubectl get endpoints api -n shop -o wide
ENDPOINTS 10.42.1.5:8080,10.42.2.3:8080
kubectl exec -n shop api-0 -- curl -sf localhost:8080/ready
ready endpoint stays in rotation
# simulate slow boot — startupProbe holds liveness off
CrashLoop on boot usually means missing startupProbe

Where this goes next

Probes keep traffic honest during rollouts; they do not replace resource limits or security context. Next: PodDisruptionBudgets so node drains respect your minimum available count, and preStop hooks so SIGTERM drains in-flight requests before readiness fails. The Kubernetes administration path covers probes, rollouts, and running workloads reliably.

Go deeper in a courseKubernetes administrationProbes, rollouts, Services, and operating workloads reliably.View course

Related posts