Liveness and readiness
Every component service in our application should provide liveness and readiness metrics as a minimum. In short, a liveness metric advertises that a service is functioning, and a readiness metric advertises that a service is available for requests. When a service is managed by an orchestrator, specifically Kubernetes, its definition can include references to endpoints that individually report these metrics. The endpoints do not need to be exposed outside of a pod.
If a liveness endpoint indicates the failure of the service or doesn’t report anything at all, the orchestrator will terminate the pod and replace it with a new instance.
If a readiness endpoint indicates the container is unavailable, the orchestrator will stop sending request traffic to it.
Note that these endpoints will not have any useful functionality in our development environment with docker-compose
. Docker is a simplified orchestrator that focuses on running multiple containers...