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

<ul>
<li>Stop to send load on the pods that will be scaled down</li>
<li>Wait for the pod to have finished to handle the load </li>
<li>Delete the pod</li>
</ul>

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

<p>Check out the <a href="https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination" rel="nofollow noreferrer">Termination of Pods</a> section in the pods user guide. You might wish to implement a <a href="http://kubernetes.io/docs/user-guide/container-environment/#hook-details" rel="nofollow noreferrer">preStop hook</a> to ensure traffic is drained before the TERM signal is sent to the processes in the pod.</p>
