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.
Kubernetes has three health probes and they do different things. Readiness decides if a pod receives traffic. Liveness decides if it gets restarted. Startup buys a slow-booting app time before the other two kick in. Confuse them and you turn a small hiccup into an outage.
Readiness
gates Service traffic
fail -> removed from endpoints
no restart
use for warm-up + deps
Liveness
detects a wedged process
fail -> container restarted
restarts, cost real
use for deadlock only
deploy.yaml
readinessProbe:httpGet: { path: /ready, port: 8080 }periodSeconds: 5livenessProbe:httpGet: { path: /healthz, port: 8080 }periodSeconds: 10failureThreshold: 3
Never check dependencies in liveness
If /healthz pings the database, a DB blip restarts every pod at once — a self-inflicted outage. Liveness should only reflect *this* process being alive. Dependency checks belong in readiness.
Startup probe for slow boots
A JVM that takes 60s to warm up will be liveness-killed before it ever serves. A startup probe holds liveness/readiness off until the app is up.
deploy.yaml
startupProbe:httpGet: { path: /healthz, port: 8080 }failureThreshold: 30periodSeconds: 5 # up to 150s to start, then liveness takes over