Health Checks and Rolling Updates
You'll learn how health probes safeguard your deployment rollouts and prevent cascading failures during updates.
Why Probes Matter During Rollouts
When Kubernetes performs a rolling update, it gradually replaces old Pods with new ones. Without proper health checks, the deployment controller might roll out broken Pods across your entire cluster before anyone notices. Probes act as quality gates that control rollout velocity and prevent disasters.
The Safety Mechanism
During a rolling update, Kubernetes relies on readiness probes to determine when a new Pod is ready to receive traffic. The deployment controller:
- Creates a new Pod with the updated spec
- Waits for the Pod's readiness probe to succeed
- Only then marks the Pod as ready and proceeds to replace the next old Pod
- If readiness keeps failing, the rollout pauses automatically
Think of it like an airport security checkpoint: passengers (Pods) can only proceed when they pass inspection. A failing readiness probe is like a suspicious bag—it stops the entire process until resolved.
Liveness probes provide a secondary safety net. If newly rolled-out Pods start crashing or hanging, liveness probes restart them, giving them another chance before the rollout continues.
Startup probes are crucial for rolling updates of applications with long initialization times, ensuring Kubernetes doesn't prematurely kill Pods that are still starting up during the transition.
Real-World Impact
Without readiness probes, a bad deployment pushes broken Pods into service immediately, causing downtime. With them, your rollout automatically stops at the first failure, typically affecting only a small percentage of your fleet based on your maxUnavailable and maxSurge settings.
Key Takeaway: Health checks are the control system for safe deployments—readiness probes gate rollout progression, while liveness probes catch runtime failures, together preventing broken releases from reaching production.