如何在Kubernetes中回收Pod [英] How to recycle pods in Kubernetes
问题描述
我希望在某些时间段(例如,每周或每月)之后,从我的部署中正常回收Pod.我知道如果知道Kubernetes命令,可以为此添加cron作业.
I want my pods to be gracefully recycled from my deployments after certain period of time such as every week or month. I know I can add a cron job for that if I know the Kubernetes command.
问题是,在Kubernetes中执行此操作的最佳方法是什么?哪个命令可以让我实现这个目标?
The question is what is the best approach to do this in Kubernetes. Which command will let me achieve this goal?
非常感谢您帮助我解决这个问题.
Thank you very much for helping me out on this.
推荐答案
由于 OP rayhan 具有 kubernetes/kubernetes
问题13488 ,环境变量的kubectl补丁就足够了.
As the OP rayhan has found out, and as commented in kubernetes/kubernetes
issue 13488, a kubectl patch of an environment variable is enough.
但是... K8s 1.15将带来 kubectl rollout restart
...即 PR 77423 被接受并合并.
But... K8s 1.15 will bring kubectl rollout restart
... that is when PR 77423 is accepted and merged.
kubectl rollout restart
现在可用于守护程序集和状态集.
kubectl rollout restart
now works for daemonsets and statefulsets.
这篇关于如何在Kubernetes中回收Pod的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!