<p>I know how to measure needed RAM and CPU usage, but not how to measure used disk space of every container in a k8s cluster.</p>
<p>I've tried cAdvisor, but only provides stats per node, not per container.</p>
<p><a href="https://github.com/google/cadvisor/issues/198" rel="nofollow noreferrer">https://github.com/google/cadvisor/issues/198</a></p>
<p>Any recommended tool/procedure?
In this way I could specify in the <code>resources</code> section of a pod, sensible values.</p>

david.perez
<p>df command you need to run in the container and also go through this <a href="https://docs.openshift.com/container-platform/4.8/storage/understanding-ephemeral-storage.html#storage-ephemeral-storage-monitoring_understanding-ephemeral-storage" rel="nofollow noreferrer">doc</a>, /bin/df as a tool to monitor ephemeral storage usage on the volume where ephemeral container data is located. Refer to this <a href="https://www.airplane.dev/blog/kubernetes-ephemeral-storage" rel="nofollow noreferrer">blog</a> by Sudip Sengupta for more information.</p>
<p><strong>Try the below commands to know kubernetes container's ephemeral-storage usage details:</strong></p>
<ul>
<li>Try <strong>du -sh / [run inside a container]</strong> : du -sh will give the space
consumed by your container files. Which simply returns the amount of
disk space the current directory and all those stuff in it are using
as a whole, something like: 2.4G.</li>
<li>Can you run   <code>kubectl exec &lt;podname&gt; -c &lt;container_name&gt;  –df -h</code> in  each container you will get the used space in that particular   container.</li>
<li>Refer to this <a href="https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#resource-emphemeralstorage-consumption" rel="nofollow noreferrer">ephemeral storage-consumption Management</a></li>
</ul>
<p><strong>Below is the Output</strong> :  <a href="https://i.stack.imgur.com/uABEo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uABEo.png" alt="output" /></a></p>
<p>Also you can check the complete file size using the <code>du -h someDir command</code>.</p>
<ul>
<li><p>Refer to this <a href="https://blog.px.dev/container-filesystems/#title" rel="nofollow noreferrer">blog</a>  by Omid Azizi for inspecting the container file systems.</p>
</li>
<li><p>Seems to be you are going to specify in the resources section of a
pod refer to this <a href="https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#setting-requests-and-limits-for-local-ephemeral-storage" rel="nofollow noreferrer">Setting requests and limits for local ephemeral
storage.</a></p>
</li>
</ul>
