Metric name | Metric type | Description | Unit (where applicable) | Labels/tags | Status |
---|---|---|---|---|---|
kube_persistentvolume_annotations | Gauge | Kubernetes annotations converted to Prometheus labels controlled via --metric-annotations-allowlist | persistentvolume =<persistentvolume-name> annotation_PERSISTENTVOLUME_ANNOTATION =<PERSISTENTVOLUME_ANNOTATION> |
EXPERIMENTAL | |
kube_persistentvolume_capacity_bytes | Gauge | persistentvolume =<pv-name> |
STABLE | ||
kube_persistentvolume_status_phase | Gauge | persistentvolume =<pv-name> phase =<Bound|Failed|Pending|Available|Released> |
STABLE | ||
kube_persistentvolume_claim_ref | Gauge | persistentvolume =<pv-name> claim_namespace =<> name =<> |
STABLE | ||
kube_persistentvolume_labels | Gauge | Kubernetes labels converted to Prometheus labels controlled via --metric-labels-allowlist | persistentvolume =<persistentvolume-name> label_PERSISTENTVOLUME_LABEL =<PERSISTENTVOLUME_LABEL> |
STABLE | |
kube_persistentvolume_info | Gauge | Information about Persistent Volumes | persistentvolume =<pv-name> storageclass =<storageclass-name> gce_persistent_disk_name =<pd-name> host_path =<path-of-a-host-volume> host_path_type =<host-mount-type> ebs_volume_id =<ebs-volume-id> azure_disk_name =<azure-disk-name> fc_wwids =<fc-wwids-comma-separated> fc_lun =<fc-lun> fc_target_wwns =<fc-target-wwns-comma-separated> iscsi_target_portal =<iscsi-target-portal> iscsi_iqn =<iscsi-iqn> iscsi_lun =<iscsi-lun> iscsi_initiator_name =<iscsi-initiator-name> local_path =<path-of-a-local-volume> local_fs =<local-volume-fs-type> nfs_server =<nfs-server> nfs_path =<nfs-path> csi_driver =<csi-driver> csi_volume_handle =<csi-volume-handle> |
STABLE | |
kube_persistentvolume_created | Gauge | Unix creation timestamp | seconds | persistentvolume =<persistentvolume-name> |
EXPERIMENTAL |
kube_persistentvolume_deletion_timestamp | Gauge | Unix deletion timestamp | seconds | persistentvolume =<persistentvolume-name> |
EXPERIMENTAL |
kube_persistentvolume_csi_attributes | Gauge | CSI attributes of the Persistent Volume, disabled by default, manage with --metric-opt-in-list) | persistentvolume =<persistentvolume-name> csi_mounter =<csi-mounter> csi_map_options =<csi-map-options> |
EXPERIMENTAL |
It is not straightforward to get the PV states for certain cases like "Terminating" since it is not stored behind a field in the PersistentVolume.Status
.
So to mimic the logic used by the kubectl
command line, you will need to compose multiple metrics.
Here is an example of a Prometheus rule that can be used to alert on a PV that has been in the Terminating
state for more than 5m
.
groups:
- name: PV state
rules:
- alert: PVBlockedInTerminatingState
expr: kube_persistentvolume_deletion_timestamp * on(persistentvolume) group_left() (kube_persistentvolume_status_phase{phase="Bound"} == 1) > 0
for: 5m
labels:
severity: warning
annotations:
summary: PV {{$labels.persistentvolume}} blocked in Terminating state.