<p>With command:</p>
<pre><code>$ kubectl delete -l type=volume -f file.yml
</code></pre>
<p>K8s will delete all object with label <code>type=volume</code>;</p>
<p>I need some command to do the opposite, something like:</p>
<pre><code>$ kubectl delete -{NOT}l type=volume -f file.yml
</code></pre>
<p>This command should delete any object in a file except for object with labels <code>type=volume</code>, it is possible?</p>

LuizBuffa
<p>You can use the <code>NOT</code> operator <code>!</code> in the <code>=</code> check with <code>key=value</code> pair as:</p>
<pre><code>kubectl get pods -n dummy -l role=x    # lists all pods with label role=x
kubectl get pods -n dummy -l role!=x   # lists all pods with label role!=x
</code></pre>
