The liveness probe answers "is it alive?". The readiness probe answers "can it take requests right now?". The two answers lead to different actions.
What a failure does
readinessProbe:
httpGet:
path: /healthz
port: 8080
periodSeconds: 5While the probe fails, the Pod's Ready condition is False. Three things follow:
Nothing is restarted. When the probe passes again the Pod goes back into the endpoints on its own.
Why both exist
An app that is warming a cache or waiting for its database is alive and should not be killed. It should also not get requests it cannot answer. That is readiness. An app that is deadlocked should be killed. That is liveness.
| Probe | On failure | Good check |
|---|---|---|
| liveness | restart the container | the process answers at all |
| readiness | stop sending traffic | the app can serve, dependencies included |
Reading it
NAME READY STATUS RESTARTS AGE
market-api-7d9c4c5b7f-x2k4p 0/1 Running 0 40s0/1 Running with RESTARTS at 0 is a readiness problem. kubectl describe pod shows Readiness probe failed: …, and kubectl describe svc shows Endpoints: <none> when no Pod is Ready.