<p>I need a shared volume accessible from multiple pods for caching files in RAM on each node.</p>

<p>The problem is that the <code>emptyDir</code> volume provisioner (which supports <code>Memory</code> as its <code>medium</code>) is available in <code>Volume</code> spec but not in <code>PersistentVolume</code> spec.</p>

<p>Is there any way to achieve this, except by creating a <code>tmpfs</code> volume manually on each host and mounting it via <code>local</code> or <code>hostPath</code> provisioner in the PV spec?</p>

<p>Note that Docker itself supports such volumes:</p>

<pre><code>docker volume create --driver local --opt type=tmpfs --opt device=tmpfs \
       --opt o=size=100m,uid=1000 foo
</code></pre>

<p>I don't see any reason why k8s doesn't. Or maybe it does, but it's not obvious?</p>

<p>I tried playing with <code>local</code> and <code>hostPath</code> PVs with <code>mountOptions</code> but it didn't work.</p>

<p>EmtpyDir tied to lifetime of a pod, so it can't be used via shared with multiple pods.
What you request, is additional feature and if you look at below github discussions, you will see that you are not the first that asking for this feature.</p>
<p><a href="https://github.com/kubernetes/kubernetes/issues/27732" rel="nofollow noreferrer">consider a tmpfs storage class</a></p>
<p>Also according your mention that <code>docker supports this tmpfs volume</code>, yes it supports, but you can't share this volume between containers. From <a href="https://docs.docker.com/storage/tmpfs/" rel="nofollow noreferrer">Documentation</a></p>
<blockquote>
<p>Limitations of tmpfs mounts:</p>
<p>Unlike volumes and bind mounts, you can’t
share tmpfs mounts between containers.</p>
</blockquote>
