[英]Setup delay for pod shutdown on update
Is it possible to setup a delay for pod shutdowns after a rolling update on Kubernetes? 在Kubernetes上进行滚动更新后,是否可以为Pod关闭设置延迟时间?
For example I roll out a new version and want the old Pods to run for further 15secs after the new instance has been started. 例如,我推出了一个新版本,并希望旧的Pod在新实例启动后再运行15秒。
How can I manage that? 我该如何处理?
Yes, you can use PreStop
Hook to achieve that. 是的,您可以使用
PreStop
Hook来实现。
PreStop
hooks are executed after a Pod is marked as terminating. 在Pod标记为终止之后执行
PreStop
挂钩。 See what happen when you delete a pod from here . 查看从此处删除窗格的情况。
You just have to run sleep 15
on PreStop
Hook. 您只需要在
PreStop
Hook上运行sleep 15
PreStop
。
For more details see Container hooks . 有关更多详细信息,请参见容器挂钩 。
See how to add a PreStop
hook from here: Define postStart and preStop handlers . 从此处了解如何添加
PreStop
挂钩: 定义postStart和preStop处理程序 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.