Pod setup process, status, and conditions
Before using readiness probes, it helps to understand how a pod reaches the running state:Ready condition
Kubernetes checks that all containers are ready. By default, it assumes a container is ready to accept traffic as soon as it starts.
The ready condition indicates the application inside the pod is ready to accept user traffic. Without a readiness probe, Kubernetes sets this to
true as soon as the container starts — which may be before your application is actually ready.What are readiness probes?
Readiness probes determine whether a container is ready to accept traffic. If the probe fails, kubelet removes the pod from service endpoints so no traffic is routed to it. The probe continues running, and the pod is re-added when the probe passes again. Common readiness probe use cases:- Test that the web application is online and responding
- Check whether a database TCP connection is ready
- Run a custom script to determine if the application has finished initializing
HTTP
Sends an HTTP GET request to the container. A 2xx or 3xx response means ready.
TCP
Opens a TCP socket to the container. A successful connection means ready.
exec
Runs a command inside the container. An exit code of
0 means ready.Usage
- HTTP
- TCP
- exec
readiness-probes.yaml
Key probe fields
| Field | Description |
|---|---|
initialDelaySeconds | Seconds to wait after the container starts before the first probe |
periodSeconds | How often the probe is performed |
failureThreshold | Number of consecutive failures before the pod is removed from endpoints (default: 3) |