How to identify the storage space left in a persistent volume claim?
If there's a running pod with mounted PV from the PVC,
kubectl -n <namespace> exec <pod-name> -- df -ah
...will list all file systems, including the mounted volumes, and their free disk space.
You can monitorize them with kubelet prometheus metrics:
kubelet_volume_stats_available_bytes{persistentvolumeclaim="your-pvc"}
kubelet_volume_stats_capacity_bytes{persistentvolumeclaim="your-pvc"}
Adding to @apisim's answer if you add -h parameter then you can get details in human readable format. Something like this,
kubectl -n <namespace> exec <pod-name> -- df -h
I wrote a script that lists all the PVCs in a cluster in a format similar to df
.
You can run it via:
./kubedf
or:
./kubedf -h
for a human readable output.
Edit: The script no longer requires kubectl proxy
to be running