Liveness versus readiness
Liveness answers whether the process is alive. A failure here means the container should be restarted. Readiness answers whether it can handle requests. A failure here means stop sending traffic, but do not restart. Consider an app that is running while its database is down. Liveness passes, because the process is alive. Readiness fails, because it cannot serve requests. The load balancer stops routing to that instance until it recovers.Response format
200 OK. Unhealthy returns 503 Service Unavailable.
Wiring it up
- Load balancer
- Kubernetes
- Docker
For AWS ALB, GCP and similar: