Liveness & Readiness Probes
Health probes monitor container status in real-time, allowing Kubernetes to automatically restart crashed containers or remove un-ready pods from service endpoints.
1. Liveness vs Readiness vs Startup Probes
| Probe Type | Trigger Action | When Fails |
|---|---|---|
LivenessProbe | Checks if the container application is alive & healthy | Kubernetes restarts the container automatically |
ReadinessProbe | Checks if the container is ready to accept user network traffic | Kubernetes removes the pod IP from Service endpoints |
StartupProbe | Checks if legacy slow-starting app initialization is complete | Disables Liveness/Readiness probes until startup succeeds |
2. Production Health Check Configuration Manifest
containers:
- name: api-server
image: my-api:latest
ports:
- containerPort: 3000
# 1. Readiness Probe (Checks HTTP /health endpoint before sending traffic)
readinessProbe:
httpGet:
path: /health
port: 3000
initialDelaySeconds: 5
periodSeconds: 10
# 2. Liveness Probe (Restarts container if deadlocked or unresponsive)
livenessProbe:
httpGet:
path: /liveness
port: 3000
initialDelaySeconds: 15
periodSeconds: 20
failureThreshold: 3Next Up
Learn Resource Limits & Management: CPU and Memory requests/limits, OOMKilled errors, and QoS classes.
Next Lesson: Resource Limits & CPU/RAM →