<p>I have multiple pods running as below. I want to delete them all except the one having minimum age. How to do it?</p>

<p><a href="https://i.stack.imgur.com/ejLRE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ejLRE.png" alt="enter image description here"></a></p>

<p>Something like this? Perhaps also add <code>-l app=value</code> to filter for a specific app</p>

<pre><code>kubectl get pods --sort-by=.metadata.creationTimestamp -o name | head -n -1 | xargs echo kubectl delete
</code></pre>

<p>(Remove <code>echo</code> to do it for realz)</p>
