简体   繁体   中英

Setup delay for pod shutdown on update

Is it possible to setup a delay for pod shutdowns after a rolling update on Kubernetes?

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.

How can I manage that?

Yes, you can use PreStop Hook to achieve that.

PreStop hooks are executed after a Pod is marked as terminating. See what happen when you delete a pod from here .

You just have to run sleep 15 on PreStop Hook.

For more details see Container hooks .

See how to add a PreStop hook from here: Define postStart and preStop handlers .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM