Interview Prep/Python for DevOps/Testing, services & metrics

What is the difference between liveness and readiness endpoints?

IntermediateConceptTesting, services & metrics
Answer
  • Liveness (/healthz, /livez): "is the process alive and not deadlocked?" Must be cheap and must not check dependencies. If it fails, Kubernetes restarts the container.
  • Readiness (/readyz): "can I serve traffic right now?" Checks critical dependencies (DB, cache) with short timeouts. If it fails, the pod is removed from Service endpoints but not restarted.

Checking the database in liveness is a classic mistake: a DB blip restarts every pod at once and turns a partial outage into a full one.

All Python for DevOps questions Roadmap: Python for automation

More on Testing, services & metrics