Infrastructure
Kubernetes Startup, Readiness, and Liveness Probes Explained
Choose startup, readiness, and liveness probes that protect traffic without turning slow dependencies into restart loops.
In this article
Kubernetes Startup, Readiness, and Liveness Probes Explained
Kubernetes has three probe types because they answer different questions. A startup probe asks whether initialization has finished. A readiness probe asks whether the Pod should receive traffic now. A liveness probe asks whether the container is stuck badly enough to restart. Reusing one endpoint for all three often creates cascading failures.
The practical model
Treat kubernetes startup, readiness, and liveness probes explained as a system with four review points: map each probe to one decision, budget timings mathematically, use purpose-built endpoints, test failure modes before rollout. Give each point an owner, a measurable acceptance condition, and a rollback trigger. Thresholds should come from observed workloads, contracts, or risk tolerance rather than an unexplained default.
Map each probe to one decision
Startup can tolerate migrations, cache loading, or model initialization. Readiness should become false when the process cannot safely serve new requests, but it should not fail just because a noncritical analytics service is down. Liveness must test an internal invariant the process cannot recover from on its own, such as a dead event loop.
Budget timings mathematically
The maximum startup allowance is failureThreshold multiplied by periodSeconds. A startup probe with a 10-second period and threshold 30 grants roughly five minutes before liveness and readiness begin. For readiness, detection time is roughly period plus network and timeout effects. Write these budgets next to measured boot and recovery percentiles.
Use purpose-built endpoints
Return quickly and avoid expensive database scans. A readiness endpoint may check that the connection pool can acquire a slot, but it should not run a full business query. A liveness endpoint should normally remain local to the process. Protect detailed diagnostics; probe responses need only a status code.
Test failure modes before rollout
In a staging namespace, block a dependency, exhaust the pool, pause the process, and force a slow boot. Watch endpoints, restarts, events, and load-balancer behavior. Confirm a dependency outage drains traffic without repeatedly destroying healthy process state.
Common pitfalls
- Making liveness depend on every downstream service.
- Setting timeoutSeconds below normal scheduler or GC pauses.
- Using initialDelaySeconds alone for highly variable startup.
- Forgetting termination grace and in-flight request draining.
A focused test plan
- Map each probe to one decision: verify that startup can tolerate migrations, cache loading, or model initialization. Then introduce the failure case “making liveness depend on every downstream service” and confirm that the system fails visibly, stays within its safety boundary, and has a documented recovery action.
- Budget timings mathematically: verify that the maximum startup allowance is failureThreshold multiplied by periodSeconds. Then introduce the failure case “setting timeoutseconds below normal scheduler or gc pauses” and confirm that the system fails visibly, stays within its safety boundary, and has a documented recovery action.
- Use purpose-built endpoints: verify that return quickly and avoid expensive database scans. Then introduce the failure case “using initialdelayseconds alone for highly variable startup” and confirm that the system fails visibly, stays within its safety boundary, and has a documented recovery action.
- Test failure modes before rollout: verify that in a staging namespace, block a dependency, exhaust the pool, pause the process, and force a slow boot. Then introduce the failure case “forgetting termination grace and in-flight request draining” and confirm that the system fails visibly, stays within its safety boundary, and has a documented recovery action.
Primary references
Conclusion
Good probes encode recovery policy, not a vague health score. Keep liveness narrow, readiness traffic-focused, startup generous enough for measured initialization, and verify the behavior with deliberate faults.