Skip to content

How to find unused PVCs in Kubernetes

Published:1 min read
#!/bin/bash
for i in $(kubectl get pvc --no-headers | awk '{print $1}');do
    kubectl describe pvc $i | grep "Used By" | awk -v pod=$i '$3=="<none>" { print "PVC " pod " not used"}'
done;