'Monitoring PVC Usage with Prometheus

I am using Prometheus 2.33 version. The following query does not work.

kubelet_volume_stats_available_bytes

kubelet_volume_stats_capacity_bytes

The following query is used to monitor the DISK usage of the POD.

container_fs_usage_bytes

container_fs_limit_bytes

Is there a way to get the usage of PVC, Limit value?



Solution 1:[1]

For PVC, Kubernetes exposes these metrics to Prometheus, you can use them to monitor a persistent volume's usage:

kube_persistentvolume_capacity_bytes 
kube_persistentvolumeclaim_resource_requests_storage_bytes

EDIT: These metrics are from kube-state-metrics - a service that produces Prometheus format metrics based on the current state of the Kubernetes native resources. It is basically listening to Kubernetes API and gathering information about its resources and objects, in particular for PV - PV metrics and PVC - PVC metrics. More information about the service is here.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1