<p>I want to monitor disk usages of persistent volumes in the cluster. I am  using <a href="https://github.com/coreos/kube-prometheus" rel="noreferrer">CoreOS Kube Prometheus</a>. A dashboard is trying to query with a metric called <strong>kubelet_volume_stats_capacity_bytes</strong> which is not available anymore with Kubernetes versions starting from v1.12.</p>

<p>I am using Kubernetes version v1.13.4 and <a href="https://github.com/MaZderMind/hostpath-provisioner" rel="noreferrer">hostpath-provisioner</a> to provision volumes based on persistent volume claim. I want to access current disk usage metrics for each persistent volume.</p>

<ul>
<li><p><strong>kube_persistentvolumeclaim_resource_requests_storage_bytes</strong> is available but it shows only the persistent claim request in bytes</p></li>
<li><p><strong>container_fs_usage_bytes</strong> is not fully covers my problem.</p></li>
</ul>

<p>Per-PVC disk space usage in percentage can be determined with the following query:</p>
<pre><code>100 * sum(kubelet_volume_stats_used_bytes) by (persistentvolumeclaim)
  /
sum(kubelet_volume_stats_capacity_bytes) by (persistentvolumeclaim)
</code></pre>
<p>The <code>kubelet_volume_stats_used_bytes</code> metric shows per-PVC disk space usage in bytes.</p>
<p>The <code>kubelet_volume_stats_capacity_bytes</code> metric shows per-PVC disk size in bytes.</p>
