<p>I have more than 4000 pvc in my kubernetes aws eks cluster.</p>
<p>From those 4000+ pvc I have to delete almost 3999 pvcs and not delete like 30 pvc.</p>
<p>I will be using the command:</p>
<pre><code>kubectl delete pvc --field-selector metadata.name!=&lt;name not to delete&gt;
</code></pre>
<p>to test before I will be using</p>
<pre><code>kubectl get pvc --field-selector metadata.name!=&lt;name not to delete&gt;
</code></pre>
<ul>
<li>now when i use the command and add the pvc name of only ONE PVC in place of &quot;name not to delete&quot; the command works..
but when I add another pvc name rather than ONE like &quot;kubectl get pvc --field-selector metadata.name!=pvc1 pvc2&quot; .. it does NOT work</li>
</ul>
<p>as I mentioned I do not want to delete 30 pvc but the rest 4000 I do want to delete... so I need to add those 30 pvc in front of the command. So I need help regarding that.</p>
<ul>
<li>Now I also want to try to select resources in bacth by LABELS of AGE.. I only want to select pvc which are more than 2 days old.. how do I do that?</li>
</ul>

devgirl
<p>You can try</p>
<pre><code>kubectl get pvc --field-selector metadata.name!=pvc1,metadata.name!=pvc2
</code></pre>
<p>See <a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#get" rel="nofollow noreferrer">https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#get</a></p>
