首页 > 解决方案 > k8s什么时候重试liveness probe?

问题描述

我试图了解活动探测的重试行为,从文档中不清楚。

我将举例说明。考虑以下活动探测规范

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)

标签: kubernetesgoogle-kubernetes-enginelivenessprobe

解决方案


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


推荐阅读