gpt4 book ai didi

kubernetes - 如何快速使Kubernetes Readiness探针失败?

转载 作者:行者123 更新时间:2023-12-02 12:24:59 25 4
gpt4 key购买 nike

万一Pod在我的集群中发生故障,大约需要15秒或更长时间才能通过就绪探测逻辑确定故障,由于 call 失败而无法接受(由于kubernetes未标识Pod故障,因此它将流量发送给失败的主机) pod /我的意思是失败的pod仍在cluster-P服务端点中)。
请在此提出建议,如何立即使准备就绪探针失败,或在发生失败的情况下如何立即删除端点,而又不将periodSeconds减少到5秒以下。
下面是我的配置:

initialDelaySeconds:90s
periodSeconds:5s
timeoutSeconds:2s
successThreshold:<default>
failureThreshold:<default>
在此先感谢。

最佳答案

您可以做的是调整probe's configuration以满足您的要求:

Probes have a number of fields that you can use to more preciselycontrol the behavior of liveness and readiness checks:

  • initialDelaySeconds: Number of seconds after the container has started before liveness or readiness probes are initiated. Defaults to0 seconds. Minimum value is 0.

  • periodSeconds: How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1.

  • timeoutSeconds: Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1.

  • successThreshold: Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1for liveness. Minimum value is 1.

  • failureThreshold: When a probe fails, Kubernetes will try failureThreshold times before giving up. Giving up in case of livenessprobe means restarting the container. In case of readiness probe thePod will be marked Unready. Defaults to 3. Minimum value is 1.


您尚未指定 failureThreshold,因此默认值为3。当前使用的值大约需要15-20秒才能将Pod视为失败并重新启动它。
如果您为 periodSecondstimeoutSecondssuccessThresholdfailureThreshold设置了最小值,则可以期望进行更频繁的检查并更快地重新启动Pod。

关于kubernetes - 如何快速使Kubernetes Readiness探针失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64496088/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com