<p>I have several Persistent Volume Claims in Google Kubernetes Engine that I am not sure if they are still used or not. How can I find out which pod they are attached to or is safe to delete them?</p>
<p>Google Kubernetes UI tells me they are bound but not to which container. Or maybe it means they are bound to a Volume Claim.</p>
<p>kubectl describe did not return the name of the pods either.</p>
<pre><code>   kubectl describe pv xxxxxx-id
</code></pre>
<p><a href="https://i.stack.imgur.com/F2bhQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F2bhQ.png" alt="enter image description here" /></a></p>

David Dehghan
<p>this gives you the PVC for each pod</p>
<pre><code>kubectl get pods --all-namespaces -o=json | jq -c '.items[] | {name: .metadata.name, namespace: .metadata.namespace, claimName: .spec |  select( has (&quot;volumes&quot;) ).volumes[] | select( has (&quot;persistentVolumeClaim&quot;) ).persistentVolumeClaim.claimName }'
</code></pre>
