kubernetespersistent-volumeskubernetes-pvc

Is there an efficient way to check the usage for PV/PVC in Kubernetes


For example, I have 50 Gib PV/PVC and grant to one Pod, I just want to check usage of the storage

The way I am just following is to set up a busybox pod with mounting the same PVC, then exec into the busybox to run df -h to check the storage.

I just want to know if there is an efficient way to do the same thing.


Solution

  • Depending on how often you need to do this you might look at the df-pv plugin for kubectl https://github.com/yashbhutwala/kubectl-df-pv

    It does exactly what you are asking across all the pvs in a namespace or cluster. Once you've got it installed, just run kubectl df-pv and you are set.