<p>I am trying to migrate my deployment from the Minikube platform to the KOPS cluster in AWS.
In my deployment, I have multiple pods that share the same pvc(persistent volume claim).</p>
<p>Therefore, accessing ebs pvc from different pods in the KOPS cluster is having problems when those pods are running on different nodes(different instances). For eg - I have 3 pods and 2 nodes. Assume pod1 is running on node1 and pod2&amp;pod3 are running on node2. pod2&amp;pod3 will not be able to attach ebs pvc after pod1 is attached to ebs pvc.</p>
<p>How to make ebs pvc accessible from different pods running on different nodes in the kops cluster in AWS?</p>
<p>volume.yaml</p>
<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: media-volume
spec:
  storageClassName: gp2-manual
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  awsElasticBlockStore:
    fsType: ext4
    volumeID: &lt;volumeID&gt;
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: media-volume-claim
spec:
  storageClassName: gp2-manual
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 20Gi
</code></pre>

<p>The quick answer here would be to use <strong><a href="https://aws.amazon.com/efs/" rel="nofollow noreferrer">EFS</a></strong> with <code>ReadWriteMany</code> access mode instead of <strong>EBS</strong>, as EBS allow only ReadWriteOnce <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes" rel="nofollow noreferrer">access mode</a>.</p>
<p>But as @KKyaw Min Thu L mentioned in comments</p>
<blockquote>
<p>Currently, I am using EFS, but my boss prefers to use EBS rather than EFS.</p>
</blockquote>
<p>As a workaround for this I would sugget to use <a href="https://www.gluster.org/" rel="nofollow noreferrer">GlusterFS</a>, it was suggested by @Harsh Manvar <a href="https://stackoverflow.com/questions/51212904/kubernetes-pvc-with-readwritemany-on-aws/59675356#59675356">here</a>.</p>
<blockquote>
<p>As you mention EBS volume with affinity &amp; node selector will stop scalability however with EBS only ReadWriteOnce will work.</p>
<p>Sharing my experience, if you are doing many operations on the file system and frequently pushing &amp; fetching files it might could be slow with EFS which can degrade application performance. operation rate on EFS is slow.</p>
<p>However, you can use GlusterFs in back it will be provisioning EBS volume. <strong>GlusterFS also support ReadWriteMany</strong> and it will be faster compared to EFS as it's block storage (SSD).</p>
</blockquote>
<p>There is <a href="https://medium.com/@naikaa/persistent-storage-kubernetes-67f0f1e1f31e" rel="nofollow noreferrer">tutorial</a> about this on medium.</p>
<blockquote>
<p><strong>GlusterFS</strong> is a connector based storage system, i.e. by itself gluster doesnt provide storage, but it connects to a durable storage and extrapolates storage to make it seamless for K8 pods.</p>
<p>The high level topology is as described in the diagram below where one EBS volume is mounted per EC2 instance that is running a kubernetes node. We have 3 EC2, EBS, K8 node setup below. We form a glusterfs cluster using the 3 EBS nodes. We can then define and carveout several persistent volumes (pv) PV1, PV2 … PV5 out of the 3 mounted EBS volumes, making it homogenous and seamless for K8 pods to claim.</p>
<p>K8 schedules pods as per its algorithm on any K8 node and the pods can claim a persistent volume via a persistent volume claim. Persistent volume claim (pvc) is nothing but a label that identifies a connection between a POD and a persitent volume. Per the diagram below we have POD C claim PV1 while POD A claim PV4.</p>
</blockquote>
<p><a href="https://i.stack.imgur.com/bVBvD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bVBvD.png" alt="enter image description here" /></a></p>
