For example, say I have a pod that performs a GET request for its liveness probe with a timeout of 5 seconds and a period of 10 seconds. Which of these timelines represents the timing of the probe?
The since-last-probe pattern:
0s: liveness probe initiated
5s: liveness probe times out
10s: liveness probe initiated again because 10 seconds have elapsed since the start of the last probe
Or the since-timeout pattern:
0s: liveness probe initiated
5s: liveness probe times out
15s: 10 seconds have elapsed since the timeout occurred, so the probe fires again
In the former there will always be 10 seconds between probes, but in the latter there could be anywhere from 10 to 15 seconds between probes depending on how quickly the request returns. Which method does Kubernetes use?
Kubernetes livenessProbe
works like this:
periodSeconds
is calculated from the time when the last probe was sentSo, in your case (timeoutSeconds=5
, periodSeconds=10
), the probes will look as follows:
0s: liveness probe initiated
5s: liveness probe times out
10s: liveness probe initiated again because 10 seconds have elapsed since the start of the last probe
If you had the opposite (timeoutSeconds=10
, periodSeconds=5
), then the probes would look as follows:
0s: liveness probe initiated
10s: liveness probe times out
10s: liveness probe initiated again