CodePark/ questions / Orchestration & Kubernetes basics
START PRACTICINGPRACTICE
Backend question · Docker › Orchestration & Kubernetes basics

A team makes the API's liveness probe query Postgres and return 500 if the query fails. What happens when the database has a short outage?

Kubernetes restarts every API Pod repeatedly, which doesn't fix the database and can make recovery worse

Kubernetes restarts every API Pod again and again. A liveness failure makes the kubelet (the agent that runs containers on each node) restart the container. The database is down for all Pods, so every Pod fails at the same time and restarts at the same time. The restarts don't fix the database. When the database comes back, all the Pods reconnect at once and flood it with connections, which can make recovery worse.

"Traffic is routed away from the Pods until the database recovers, and nothing is restarted" describes a readiness probe, not a liveness probe. A liveness probe should only check that the process itself is healthy, not its dependencies.


"Only one Pod is restarted at a time because of the Deployment's
maxUnavailable" is wrong because maxUnavailable only applies to rollouts, not to probe restarts.