<p>In k8s, we can use the <code>memory</code> medium(<code>tmpfs</code> instance) to define the <code>emptyDir</code> volume and mount it to pod's container. In the container, we can read and write data according to the <code>file</code> interface.</p>

<p>I want to know how does k8s achieve the association of <code>file</code> and <code>memory</code>? What is the principle of reading and writing <code>memory</code> data as <code>file</code>? <code>mmap</code>?</p>

Long.zhao
<p>According to <a href="https://en.wikipedia.org/wiki/Tmpfs" rel="nofollow noreferrer">wikipdia</a>:</p>

<blockquote>
  <p>tmpfs is a temporary file storage paradigm <strong>implemented in many Unix-like operating systems</strong>. It is intended to appear as a mounted file system, but data is stored in volatile memory instead of a persistent storage device. A similar construction is a RAM disk, which appears as a virtual disk drive and hosts a disk file system.</p>
</blockquote>

<p>So its not k8s feature. Is is a Linux feature that just appears to be used by k8s.</p>

<p>You can read more about it in <a href="https://www.kernel.org/doc/Documentation/filesystems/tmpfs.txt" rel="nofollow noreferrer">linux kernel documentation</a></p>
