How to identify the storage space left in a persistent volume claim?

ilegolas picture ilegolas · Nov 8, 2018 · Viewed 12.7k times · Source

I have a Kubernetes cluster on Google Cloud Platform. It has a persistent Volume Claim with a Capacity of 1GB. The persistent volume claim is bound to many deployments.

I would like to identify the space left in the persistent Volume Claim in order to know if 1GB is sufficient for my application.

I have used the command "kubectl get pv" but this does not show the storage space left.

Answer

apisim picture apisim · Nov 9, 2018

If there's a running pod with mounted PV from the PVC,

kubectl -n <namespace> exec <pod-name> df

...will list all file systems, including the mounted volumes, and their free disk space.