Skip to content

How to find unused PVCs in Kubernetes

Published: at 06:00 PM
#!/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;