Skip to content

Simple metrics exporter for any hostPath PersistentVolumes that share the same provisioned path .

Notifications You must be signed in to change notification settings

ugur99/local-path-provisioner-pv-metrics-exporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Local Path Provisioner Metrics Exporter

Docker Build Vulnerability Scanning

This is a simple metrics exporter for the local-path-provisioner or any hostPath typed PersistentVolumes that share the same provisioned path on the hosts. It generates local_volume_stats_capacity_bytes and local_volume_stats_used_bytes metrics for the persistent volumes PV based on the hostPath solution.

Getting Started

Easy deployment of local-path-provisioner made it one of the most popular dynamic PV provisioning tool, especially used in the dev environment. Since the local-path-provisioner is a hostPath-based solution, It does not support any integrations to generate metrics such as kubelet_volume_stats_used_bytes or kubelet_volume_stats_capacity_bytes. Some use cases and warnings for the hostPath solution are listed on the kubernetes documentation. But since the local-path-provisioner provides a dynamic provisioning solution it is a good alternative for development and testing environments in which data loss can be tolerated.

Another alternative is local typed ones, but there are some limitations to using local type volumes too as stated in sig-storage-local-static-provisioner best practices. So unless we have separate partitions for each PV, we cannot use the metrics kubelet_volume_stats.* because it will show the total capacity and used bytes of the whole partition, not the PV. Also, It does not support dynamic provisioning, and that's another critical point for development and testing environments.

Architecture

We have two main components in this solution:

lp-exporter

The first one is the lp-exporter which talks to the API Server to get PVC names that used local-path storage class and requested capacities of them respectively. It generates local_volume_stats_capacity_bytes metrics and pushes it to pushgateway. To get the used bytes per PV, it generates a job for each different node that PVs are provisioned.

lp-exporter-job

Job consists of a simple python code block to get used bytes for each PVs that are provisioned on that node and it pushes the local_volume_stats_used_bytes metrics to the pushgateway. mainarchitecture

Simple Illustration of the architecture

Grafana Dashboard && Prometheus Alerts

Take a look grafana dashboard examples and alert examples rules.

How to use?

For deployment and usage, please take a look at the deployment page.

Known Issues

Some known issues are listed in the issues page.

Disclaimer

This is not an official solution. It is just a simple solution to generate metrics for local-path-provisioner by using prometheus/kubernetes python clients and prometheus pushgateway. It is not tested in a production environment.