例如,假设我有一个 pod,它对其活性探针执行 GET 请求,超时时间为 5 秒,周期为 10 秒。以下哪个时间线代表了调查的时间?
自上次探测以来的模式:
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
Run Code Online (Sandbox Code Playgroud)
或自超时模式:
0s: liveness probe initiated
5s: liveness probe times out
15s: 10 seconds have elapsed since the timeout occurred, so the probe fires again
Run Code Online (Sandbox Code Playgroud)
在前者中,探测之间始终有 10 秒的间隔,但在后者中,探测之间的间隔可能为 10 到 15 秒,具体取决于请求返回的速度。Kubernetes 使用哪种方法?
Kubernetes 的livenessProbe工作原理如下:
periodSeconds从最后一次发送探测的时间开始计算因此,在您的情况(timeoutSeconds=5、periodSeconds=10)中,探测器将如下所示:
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
Run Code Online (Sandbox Code Playgroud)
如果您有相反的 ( timeoutSeconds=10, periodSeconds=5),则探针将如下所示:
0s: liveness probe initiated
10s: liveness probe times out
10s: liveness probe initiated again
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
663 次 |
| 最近记录: |