HeadlinesBriefing favicon HeadlinesBriefing.com

How Kubernetes Probes Work: Startup, Readiness & Liveness

Hacker News •
×

Kubernetes probes help make applications more resilient by determining container health. Without probes, Kubernetes considers containers Ready immediately upon starting, even if they're still initializing. This leads to failed requests during startup and restart loops.

The article demonstrates this using webernetes, a TypeScript port of Kubernetes with over 100,000 lines of ported Go code. It shows how a pod without probes causes request failures when restarted, since Kubernetes treats it as Ready despite ongoing startup work.

Three types of probes solve this: Startup probes determine if an application has started, Readiness probes determine if it's ready to receive traffic, and Liveness probes determine if it needs restarting. Adding a startup probe to a pod makes it show as Not Ready until the probe succeeds, preventing traffic from reaching unready containers.

For production setups, the article recommends using Replica Sets with Services for load balancing. When a pod is deleted, Kubernetes applies a 30-second termination grace period, removes it from Services, and Replica Sets create replacements. This ensures continuous availability with no request failures during deployments.