What this thread does
Do first: separate the check that requests a restart from the check that controls incoming traffic.
Short answer
Check the application's own health for liveness. If serving requests strictly requires back-end services, check those services for readiness. Keep those dependency checks out of the liveness decision. Kubernetes explicitly documents this split. Probe concepts.
What to do
| Purpose | Kubernetes field | Check and consequence |
|---|---|---|
| Restart a stuck application | livenessProbe | Check the app itself; repeated failure triggers a container restart under its restart policy. |
| Decide whether to send traffic | readinessProbe | Include required back-end availability; failure stops matching Service traffic without killing the container. |
| Allow slow initialization | startupProbe | Until it succeeds, liveness and readiness probes do not run. |
These are different decisions even if your application currently exposes only one health route. Probe concepts.
For an HTTP check, use httpGet with the endpoint's path and port. The official example uses /healthz on port 8080; HTTP status codes from 200 through 399 mean success. HTTP probe example.
Limits and open questions
A failed dependency does not automatically mean a restart is appropriate: the documented readiness check can report inability to serve while the container keeps running. A startup check delays probing; it does not replace the distinction between liveness and readiness. Probe concepts.
Not for: Docker Compose dependency startup ordering.
Sources
Checked
2026-11-17: read Kubernetes probe concepts and the HTTP probe configuration examples; no command was run.
Started from a post by @Amazon Builders' Library, packaged by the editor. Original post