Configure PVC Metrics

From v12.2.0, the Sysdig Agent can collect performance and usage metrics for Persistent Volume Claims (PVCs). Monitoring PVC metrics is crucial for understanding Kubernetes storage performance, capacity, and usage trends. In the Sysdig Monitor UI, you can use our templates to build Dashboards and Alerts for PVC metric.

Prerequisites

PVC objects are monitored automatically with Sysdig Agent v12.2.0 and above.

To learn about agent configuration, see Configure the Agent

Apply Rules

If you are upgrading the Sysdig agent, either download sysdig-agent-clusterrole.yaml or apply the following rule to the ClusterRole associated with your Sysdig agent.

rules:
- apiGroups:
  - ""
  resources:
  - nodes/metrics
  - nodes/proxy
- nonResourceURLs:
  - /metrics
  verbs:
  - get

The rules are required to scrape the kubelet containers. With this rule enabled, you will also have the kubelet metrics and can access kubelet templates for both dashboards and alerts.

This configuration change is only required for agent upgrades because the sysdig-agent-clusterrole.yaml associated with fresh installations will already have this configuration. See Steps for Kubernetes (Vanilla) for information on Sysdig agent installation.

Sysdig Agent v12.3.x and Above

The following kube-state-metrics (KSMs) are enabled by default for Sysdig agent v12.3.0 and above. The configuration for collecting the resource metrics looks similar to:

k8s_extra_resources:
  include:
     - services
     - resourcequotas
     - persistentvolumes
     - persistentvolumeclaims
     - storageclasses

Disable Collecting PVC Metrics

To disable collecting PVC metrics, add the following to the dragent.yaml file:

k8s_extra_resources:
  include:
    - services
    - resourcequotas

For details on how to configure dragent.yaml, see Configure the Agent

Here, you remove the entries corresponding to the persistentvolumes and persistentvolumeclaims resources from the k8s_extra_resources.

Collect Additional Resource Metrics

To enable collecting other resource metrics, such as horizontalpodautoscalers, add the entries corresponding to the resources to the dragent.yaml file:

k8s_extra_resources:
  include:
     - services
     - resourcequotas
     - persistentvolumes
     - persistentvolumeclaims
     - storageclasses
     - horizontalpodautoscalers
     - ingresses
     - certificatesigningrequests
   

For more information, see Enable Kube State Metrics.

Sysdig Agent Prior to v12.3.0

Contact your Sysdig representative or Sysdig Support for technical assistance with enabling PVC metrics in your environment.

  • Upgrade Sysdig agent to v12.2.0 or above

  • If you are an existing Sysdig user, include the following configuration in the dragent.yaml file:

    k8s_extra_resources:
      include:
        - persistentvolumes
        - persistentvolumeclaims
        - storageclasses
    

Access PVC Dashboard from the Library

  1. Log in to Sysdig Monitor and click Dashboards.

  2. On the Dashboards slider, scroll down to locate Dashboard Library (formerly: Dashboard Templates).

  3. Click Kubernetes to expand the Kubernetes section.

  4. Select the PVC and Storage dashboard.

Access PVC Alert Template

  1. Log in to Sysdig Monitor and click Alerts.

  2. On the Alerts page, click Library.

  3. On the Library page, click All Templates.

  4. Select the Kubernetes PVC alert templates.

PVC Metrics

MetricsMetric TypeLabelsMetric Source
kube_persistentvolume_status_phaseGaugepersistentvolume, phaseKubernetes API
kube_persistentvolume_claim_refGaugepersistentvolume, nameKubernetes API
kube_storageclass_createdGaugestorageclassKubernetes API
kube_storageclass_infoGaugestorageclass, provisioner, reclaim_policy, volume_binding_modeKubernetes API
kube_storageclass_labelsGaugestorageclassKubernetes API
kube_pod_spec_volumes_persistentvolumeclaims_infoGaugenamespace, pod, uid, volume, persistentvolumeclaimKubernetes API
kube_pod_spec_volumes_persistentvolumeclaims_readonlyGaugenamespace, pod, uid, volume, persistentvolumeclaimKubernetes API
kube_persistentvolumeclaim_status_conditionGaugenamespace, persistentvolumeclaim, type, statusKubernetes API
kube_persistentvolumeclaim_status_phaseGaugenamespace, persistentvolumeclaim, phaseKubernetes API
kube_persistentvolumeclaim_access_modeGaugenamespace, persistentvolumeclaim, access_modeKubernetes API
kubelet_volume_stats_inodesGaugenamespace, persistentvolumeclaimKubelet
kubelet_volume_stats_inodes_freeGaugenamespace, persistentvolumeclaimKubelet
kubelet_volume_stats_inodes_usedGaugenamespace, persistentvolumeclaimKubelet
kubelet_volume_stats_used_bytesGaugenamespace, persistentvolumeclaimKubelet
kubelet_volume_stats_available_bytesGaugenamespace, persistentvolumeclaimKubelet
kubelet_volume_stats_capacity_bytesGaugenamespace, persistentvolumeclaimKubelet
storage_operation_duration_seconds_bucketGaugeoperation_name, volume_plugin,leKubelet
storage_operation_duration_seconds_sumGaugeoperation_name, volume_pluginKubelet
storage_operation_duration_seconds_countGaugeoperation_name, volume_pluginKubelet
storage_operation_errors_totalGaugeoperation_name, volume_pluginKubelet
storage_operation_status_countGaugeoperation_name, status, volume_pluginKubelet