intermediate

Health checks

Separate liveness, readiness, startup, and dependency checks so orchestrators route traffic and restart services correctly.

Orchestrators use health endpoints to route traffic and restart unhealthy instances. Liveness answers "should this process restart?" Readiness answers "can this instance accept traffic?" Startup probes protect slow-booting apps. Dependency checks belong in readiness, not liveness, to avoid restart loops.

On interviews: distinguish liveness versus readiness for a service that cannot reach Kafka briefly.

Common pitfalls: checking downstream DB in liveness; readiness always true; health endpoint doing heavy work.

The trade-off is flexibility versus complexity—know when the simpler path is enough.

Checklist:

  • Separate liveness, readiness, and startup probes.
  • Keep liveness cheap and process-focused.
  • Remove from load balancer when not ready.
  • Version health responses for debugging.