<p>One of our containers is using ephemeral storage but we don't know why. The app running in the container shouldn't be writing anything to the disk.</p>
<p>We set the storage limit to 20MB but it's still being evicted. We could increase the limit but this seems like a bandaid fix.</p>
<p>We're not sure what or where this container is writing to, and I'm not sure how to check that. When a container is evicted, the only information I can see is that the container exceeded its storage limit.</p>
<p>Is there an efficient way to know what's being written, or is our only option to comb through the code?</p>

Jessie
<p>Adding details to the topic.</p>
<blockquote>
<p>Pods use ephemeral local storage for scratch space, caching, and logs.
<strong>Pods can be evicted due to other pods filling the local storage, after which new pods are not admitted until sufficient storage has been reclaimed.</strong></p>
</blockquote>
<p>The kubelet can provide scratch space to Pods using local ephemeral storage to mount <a href="https://kubernetes.io/docs/concepts/storage/volumes/#emptydir" rel="nofollow noreferrer">emptyDir</a> volumes into containers.</p>
<ul>
<li><p>For container-level isolation, if a container's writable layer and log usage exceeds its storage limit, the kubelet marks the Pod for eviction.</p>
</li>
<li><p>For pod-level isolation the kubelet works out an overall Pod storage limit by summing the limits for the containers in that Pod. In this case, if the sum of the local ephemeral storage usage from all containers and also the Pod's emptyDir volumes exceeds the overall Pod storage limit, then the kubelet also marks the Pod for eviction.</p>
</li>
</ul>
<p>To see what files have been written since the pod started, you can run:</p>
<pre><code>find / -mount -newer /proc -print
</code></pre>
<p>This will output a list of files modified more recently than '/proc'.</p>
<pre><code>/etc/nginx/conf.d
/etc/nginx/conf.d/default.conf
/run/secrets
/run/secrets/kubernetes.io
/run/secrets/kubernetes.io/serviceaccount
/run/nginx.pid
/var/cache/nginx
/var/cache/nginx/fastcgi_temp
/var/cache/nginx/client_temp
/var/cache/nginx/uwsgi_temp
/var/cache/nginx/proxy_temp
/var/cache/nginx/scgi_temp
/dev
</code></pre>
<p>Also, try without the '-mount' option.</p>
<p>To see if any new files are being modified, you can run some variations of the following command in a Pod:</p>
<pre><code>while true; do rm -f a; touch a; sleep 30; echo &quot;monitoring...&quot;; find / -mount -newer a -print; done
</code></pre>
<p>and check the file size using the <code>du -h someDir</code> command.</p>
<p>Also, as @gohm'c pointed out in his answer, you can use sidecar/ephemeral debug containers.</p>
<p>Read more about <a href="https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#local-ephemeral-storage" rel="nofollow noreferrer">Local ephemeral storage here</a>.</p>
