<p>I want to setup a PVC on AWS, where I need <code>ReadWriteMany</code> as access mode. Unfortunately, EBS only supports <code>ReadWriteOnce</code>.</p>

<p>How could I solve this?</p>

<ul>
<li>I have seen that there is a beta provider for AWS EFS which supports <code>ReadWriteMany</code>, but as said, this is still beta, and its installation looks somewhat flaky.</li>
<li>I could use node affinity to force all pods that rely on the EBS volume to a single node, and stay with <code>ReadWriteOnce</code>, but this limits scalability.</li>
</ul>

<p>Are there any other ways of how to solve this? Basically, what I need is a way to store data in a persistent way to share it across pods that are independent of each other.</p>

<h3>Using EFS without automatic provisioning</h3>

<p>The EFS provisioner may be beta, but EFS itself is not. Since EFS volumes can be mounted via NFS, you can simply create a <code>PersistentVolume</code> with a NFS volume source manually -- assuming that automatic provisioning is not a hard requirement on your side:</p>

<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: my-efs-volume
spec:
  capacity:
    storage: 100Gi # Doesn't really matter, as EFS does not enforce it anyway
  volumeMode: Filesystem
  accessModes:
    - ReadWriteMany
  mountOptions:
    - hard
    - nfsvers=4.1
    - rsize=1048576
    - wsize=1048576
    - timeo=600
    - retrans=2
  nfs:
    path: /
    server: fs-XXXXXXXX.efs.eu-central-1.amazonaws.com
</code></pre>

<p>You can then claim this volume using a <code>PersistentVolumeClaim</code> and use it in a Pod (or multiple Pods) as usual.</p>

<h3>Alternative solutions</h3>

<p>If automatic provisioning is a hard requirement for you, there are alternative solutions you might look at: There are several distributed filesystems that you can roll out on yourcluster that offer <code>ReadWriteMany</code> storage on top of Kubernetes and/or AWS. For example, you might take a look at <a href="https://rook.io/" rel="noreferrer">Rook</a> (which is basically a Kubernetes operator for Ceph). It's also officially still in a pre-release phase, but I've already worked with it a bit and it runs reasonably well.
There's also the <a href="https://github.com/gluster/gluster-kubernetes" rel="noreferrer">GlusterFS operator</a>, which already seems to have a few stable releases.</p>
