Member-only story
Kubernetes POD Liveness
I suggest you go thru my previous article on POD readiness first.
Lets take this example.
You start nginx image using docker and it starts to serve users. If the application crashed and nginx process exits, container will exit as well. Since the docker is not orchestration engine, container continue to be dead until we manually create a new container.
If you run the same application with kubernetes, every time when application crashes, it will attempt to restart it and restore. This is what we need.
However what if the application inside the container is not working and container is still up and running?
For example, may be due to bug in code application is crashed and container is still up and running. As far as kuberntes is concerned, the application is assumed to be up so does the container, but users are not served.
In that case the container should be restarted or new container should be brought up. That is where liveness probe can help.
Liveness probe can be configured on the container to periodically test the application inside the container is healthy.