<p>Is there a way to tell <code>k8s</code> to delete the oldest <code>pods</code> in the <code>deployment</code> first?</p>

<p>For instance I have a <code>deployment</code> which consist of 3 pods. I then decided to scale it up by adding 3 more <code>pods</code>:</p>

<pre><code>kubectl scale deployment some-deployment --replicas=6
</code></pre>

<p>After finishing my tests I want it to be 3 pods again, so I scale it down:</p>

<pre><code>kubectl scale deployment some-deployment --replicas=3
</code></pre>

<p>Is there a way to configure deployment in a way so that during the scale down process the oldest pods would be removed first? What if I need it the other way around, delete more recent pods first?</p>

<p>This is an open <a href="https://github.com/kubernetes/kubernetes/issues/45509" rel="nofollow noreferrer">issue</a>. You may find <a href="https://github.com/kubernetes/kubernetes/issues/4301" rel="nofollow noreferrer">this related item</a> interesting. Currently you are not able to do it. Let's hope it will be fixed soon.</p>
