You can utilize two metrics to monitor your Persistent Volume Claims (PVCs), despite the name "volume" being used. The metrics are as follows:
kubelet_volume_stats_capacity_bytes
: This metric indicates the total capacity of the volume.
kubelet_volume_stats_used_bytes
: This metric represents the current usage of the volume.
To specify a particular PVC, you can employ the filter persistentvolumeclaim="PVC_NAME"
and replace "PVC_NAME" with the actual name of your PVC.
For instance, you can calculate the usage percentage using the following query:
100.0 * kubelet_volume_stats_used_bytes{job="kubelet", namespace="btel", persistentvolumeclaim="storage-volume-cpro-server-1"} / kubelet_volume_stats_capacity_bytes
This query provides the usage percentage for the PVC named "storage-volume-cpro-server-1" in the "btel" namespace, based on the kubelet_volume_stats_used_bytes and kubelet_volume_stats_capacity_bytes metrics.