Readiness Probes – In Detail
Purpose and Function
Readiness probes determine if a container is ready to accept traffic. When a pod is not ready:
- The pod’s IP is removed from the endpoints list of all Services matching the pod
- Traffic is not routed to the pod until it passes readiness checks again
- The pod remains running but is effectively removed from service rotation
Liveness Probes – In Detail
Purpose and Function
Liveness probes determine if a container is running properly. When a pod fails liveness checks:
- The container is terminated and restarted according to the pod’s restart policy
- This helps recover from deadlocks, infinite loops, and other “stuck” states
- The container is forcibly restarted to resolve the issue
Key Differences Between Readiness and Liveness Probes
| Aspect | Readiness Probe | Liveness Probe |
|---|---|---|
| Purpose | Determines if pod should receive traffic | Determines if pod should be restarted |
| Action on Failure | Remove pod from service endpoints | Terminate and restart container |
| Recovery Method | Pod remains running | Pod gets restarted |
| Use Case | Temporary failures, initialization | Permanent failures requiring restart |
| Configuration | Can have higher failure thresholds | Should have conservative thresholds |
| Timing | Check immediately after container starts | Delay until application fully initialized |
| Probe Endpoint | Often checks external dependencies | Typically checks internal application state |
| successThreshold | Can be > 1 | Always 1 (must succeed once to transition to success) |
Leave a Reply