kubernetesgoogle-kubernetes-enginelivenessprobe

When is liveness probe retried in k8s?


I am trying to understand the retry behavior for liveness probe, its not clear from documentation.

I will to illustrate with an example. Consider the following spec for liveness probe

periodSeconds: 60
timeoutSeconds: 15
failureThreshold: 3

Lets assume the service is down

Which behavior is expected?

the probe kicks off at 0s
sees a failure at 15s, (due to timeoutSeconds 15) 
retry1 at ~15s, fail at ~30s and retry2 at ~30s, fail at ~45 (retry immediately after failure)
ultimately restart pod at ~45s (due to failureThreshold 3)

or

the probe kicks off at 0s
sees a failure at 15s, (due to timeoutSeconds 15) 
retry1 at ~60s, fail at ~75s and retry2 at ~120s, fail at ~135s (due to periodSeconds 60, doesnt really do retry after a failure)
ultimately restart pod at ~180s (due to failureThreshold 3)

Solution

  • periodSeconds is how often it checks. If you mean retry after crossing the failure threshold it never will because the container is full restarted from scratch.