<p>How can I tell with <code>kubectl</code> how much <a href="https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#local-ephemeral-storage" rel="noreferrer">ephemeral storage</a> a pod is currently using?</p>

<p>In a Kubernetes pod spec, I can specify resource requests and limits for CPU, memory, and ephemeral storage:</p>

<pre><code>resources:
  requests:
    memory: "60Mi"
    cpu: "70m"
    ephemeral-storage: "2Gi"
  limits:
    memory: "65Mi"
    cpu: "75m"
    ephemeral-storage: "4Gi"
</code></pre>

<p>However, to set good requests and limits on ephemeral storage, I need to know what this value actually is for a running pod, which I can't figure out. I can get CPU and memory usage using <code>kubectl top pod</code>, but, from what I can tell, <a href="https://github.com/kubernetes/kubernetes/blob/30a06af453059ffe636f483b7db914d51757139a/pkg/kubelet/eviction/eviction_manager.go#L503" rel="noreferrer">ephemeral storage usage is only actually calculated when making an actual eviction decision</a>.</p>

bskaggs
<p>You can do this through the raw command.</p>
<p><code>kubectl get --raw &quot;/api/v1/nodes/(your-node-name)/proxy/stats/summary&quot;</code></p>
<p>There is also this</p>
<p><code>kubectl get --raw &quot;/api/v1/nodes/(your-node-name)/proxy/metrics/cadvisor&quot;&quot;</code></p>
<p>EDIT:</p>
<p>I've created a Prometheus exporter for this now.</p>
<p><a href="https://github.com/jmcgrath207/k8s-ephemeral-storage-metrics" rel="noreferrer">https://github.com/jmcgrath207/k8s-ephemeral-storage-metrics</a></p>
