I just wanted to understand significant difference between readinessProbs and livenessProbs. looks like both can used for checking the application status/health inside container. Hence based on status of application it will update the Ready status of pod.
Can we use both during the pod creation? if both are used for same purpose which one is the best to use. what i understood is livenessProbs can we used for checking status of app on regular intervals where as readinessProb checking status during pod created at first time.
The different types of probes execute at different times.
- startupProbes execute as a container is just starting up. If it fails, the container does not start. This is a good time to do a bit of initial work for before the container starts doing its work.
- readinessProbes execute next, but before the kubelet starts sending traffic to the container. If the readinessProbe never returns a 0 (success), the container will not start up, and neither will the pod. But once it returns, the container is Ready.
- After the pod has started up and traffic starts coming into the pod, the container will execute a livenessProbe periodically, to determine if the container is still in a good and valid state. If the livenessProbe succeeds, everything continues happily. If it returns a non-zero code enough times (the number is configurable), the container fails, and is restarted.
okay thank you rob. but i did’t see any session on startupProbes. Let see in coming sessions to be covered to understand.
I don’t think it’s covered in CKA or CKAD. But it’s in the docs. You can use a startupProbe in some of the same uses as you might use an initContainer.