Wait for clean shutdown before scaling down a pod on Kubernetes

4/21/2016

I need to scale down the number of pods in a replica controllers. However, I need a clean scale down:

  • Stop to send load on the pods that will be scaled down
  • Wait for the pod to have finished to handle the load
  • Delete the pod

I do not want a pod to be deleted when it is still doing stuff. Is there a way to do that with Kubernetes?

-- poiuytrez
kubernetes
kubernetes-health-check

1 Answer

4/21/2016

Check out the Termination of Pods section in the pods user guide. You might wish to implement a preStop hook to ensure traffic is drained before the TERM signal is sent to the processes in the pod.

-- EricM
Source: StackOverflow