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.