Skip to content
DevOpsCommand

Readiness vs Liveness Probes: Stop Kubernetes Restarting Healthy Pods

Misconfigured probes cause outages during deploys and traffic spikes. Here is how to set them correctly.

By DevOpsCommand Engineering · · 1 min read

Readiness vs Liveness Probes: Stop Kubernetes Restarting Healthy Pods — illustration

Kubernetes probes are meant to improve reliability, but a common misconfiguration does the opposite: under load, a slow dependency causes liveness checks to fail, Kubernetes restarts perfectly healthy pods, and a brief slowdown becomes an outage.

Three probes, three questions

  • Startup probe — has the application finished starting? Other probes are paused until it succeeds.
  • Readiness probe — should this pod receive traffic right now? Failure removes the pod from Service endpoints but does not restart it.
  • Liveness probe — is this process irrecoverably stuck? Failure restarts the container.

The rule that prevents most incidents

Liveness checks should test only the process itself. Do not include database, cache or downstream API checks in a liveness endpoint. If the database is slow, restarting every application pod will not fix it — it will add a thundering herd of reconnections on top.

Dependency checks belong in readiness, and even there only for dependencies without which the pod genuinely cannot serve any request.

A sensible starting configuration

startupProbe:
  httpGet: { path: /healthz, port: 8080 }
  periodSeconds: 5
  failureThreshold: 30     # allows up to 150s to start
readinessProbe:
  httpGet: { path: /ready, port: 8080 }
  periodSeconds: 5
  failureThreshold: 3
livenessProbe:
  httpGet: { path: /healthz, port: 8080 }
  periodSeconds: 10
  timeoutSeconds: 2
  failureThreshold: 6      # a full minute before restarting

Graceful shutdown matters too

When a pod is terminated, it is removed from endpoints at roughly the same moment it receives SIGTERM. Handle SIGTERM by finishing in-flight requests before exiting, and set terminationGracePeriodSeconds long enough for that to happen. A short preStop sleep can help cover the propagation delay.

Checklist

  • Use a startup probe for slow-starting applications instead of a long initialDelaySeconds.
  • Keep liveness checks cheap and dependency-free.
  • Make liveness more tolerant than readiness.
  • Combine readiness probes with a PodDisruptionBudget and rolling update settings for zero-downtime deploys.

Need a second pair of eyes on your cluster? See our Kubernetes Administration service or book a free technical review.

Let's talk

Want an engineer to set this up for you?

A 30-minute call. No pressure, no sales pitch — just an engineer looking at what you actually have and telling you what it needs.