什么时候在 k8s 中重试 liveness probe?

When is liveness probe retried in k8s?

我正在尝试了解 liveness probe 的重试行为,documentation 中并不清楚。

我举个例子来说明。考虑以下活性探测规范

periodSeconds: 60
timeoutSeconds: 15
failureThreshold: 3

假设服务已关闭

哪种行为是预期的?

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)

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)

periodSeconds 是它检查的频率。如果你的意思是在超过失败阈值后重试,它永远不会,因为容器完全从头开始重新启动。