<p>I have tried below command. but this command gets all the pods which are not running for some reason any other way to do this </p>

<pre><code>kubectl delete pods -A --field-selector=status.phase!=Running
</code></pre>

Gajukorse
<p>This might be what you are looking for, but uses awk and unix output piping.</p>

<pre><code>kubectl get pods --field-selector 'status.phase=Failed' --all-namespaces | awk '{if ($4 != "Running") system ("kubectl -n " $1 " delete pods " $2 )}'
</code></pre>
