<p>I have a pod with the following volume specified</p>

<pre><code>- name: file-storage
  emptyDir:
    medium: Memory
</code></pre>

<p>also have the ephemeral storage specified in the requests and limits:</p>

<pre><code>limits:
  cpu:                2
  ephemeral-storage:  2Gi
  memory:             2Gi
requests:
  cpu:                1
  ephemeral-storage:  2Gi
  memory:             2Gi
</code></pre>

<p>Now I am wondering, will the emptyDir.medium take precedence so that I get to use the RAM or the I get the ephemeral-storage and let kubernetes decide the best for me?</p>

<p>If you do not specify where to create an emptyDir , it gets created on the disk space of the Kubernetes node.</p>

<p>If you need a small scratch volume, you can define it to be created in RAM. As soon as you start using emptyDir.medium it starts using RAM.</p>

<p>You can check the same by creating a deployment of busybox, exec into the pod and run df -h and then you can check you would get a tmpfs (RAM) FileSystem type.</p>

<p>The default size of a RAM-based emptyDir is half the RAM of the node it runs on. With limits and requests please try and check what the size of disk comes out to be. Is it still from the node or does it pick up from limits values.</p>

<p>Please check this excercise for better understanding
<a href="https://www.alibabacloud.com/blog/kubernetes-volume-basics-emptydir-and-persistentvolume_594834" rel="nofollow noreferrer">https://www.alibabacloud.com/blog/kubernetes-volume-basics-emptydir-and-persistentvolume_594834</a></p>
