Liveness Probe

What is a ā€œLiveness Probeā€?

ā€œLiveness Probeā€ is a kind of health check. Kubernetes (kubelet) performs and reacts to the probes on running containers. ā€œLiveness Probeā€ indicates whether the Container is running. If the ā€œLiveness Probeā€ fails, the kubelet kills the Container, and the Container is subjected to its restart policy. If a Container does not provide a liveness probe, the default state is Success.

In a nutshell, returning success to a liveness probe means: ā€œthe process is able to continue operatingā€; returning failure means ā€œthe process is unable to continue operating properly, and should be restarted to recoverā€.

Why is a ā€œLiveness Probeā€ necessary?

For example, let’s say your container is running but encounters an issue or becomes unhealthy (e.g. because a deadlock is detected). It is unable to make progress now. Restarting the container can recover it from unhealthy status. If you configure ā€œLiveness Probeā€ properly, Kubernetes does it for you.

What’s next