gpt4 book ai didi

kubernetes - k8s- Pane 重启时间

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

我正在运行此程序以查看作业重新启动在k8s中的工作方式。

kubectl run alpine --image=alpine --restart=OnFailure -- exit 1

Alpine 的影像已经在那里。第一次故障几乎在一秒钟内发生。 k8s需要5分钟才能完成5次重启!为什么不立即尝试?有什么办法可以减少两次重启之间的时间?

enter image description here

最佳答案

看看Pod Lifecycle文档:

Exited Containers that are restarted by the kubelet are restarted with an exponential back-off delay (10s, 20s, 40s …) capped at five minutes, and is reset after ten minutes of successful execution.



我认为没有办法配置退避延迟时间。
编辑:有一个 open issue请求此功能。

另外,请注意,使用 kubectl run 并不是在模拟“作业重新启动” 。作业由 Job Controllers管理,当处理pod / container错误时,它的行为略有不同,因为它考虑了 restartPolicyparallelismcompletionsbackoffLimit配置的组合:

There are situations where you want to fail a Job after some amount of retries due to a logical error in configuration etc. To do so, set .spec.backoffLimit to specify the number of retries before considering a Job as failed. The back-off limit is set by default to 6. Failed Pods associated with the Job are recreated by the Job controller with an exponential back-off delay (10s, 20s, 40s …) capped at six minutes.

关于kubernetes - k8s- Pane 重启时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55248749/

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