<p>I have attached an EBS volume to one of the nodes in my cluster and I want that whatever pod are coming up, irrespective of the nodes they are scheduled onto, should use that EBS volume. is this possible?</p>
<p>My approach was to create a PV/PVC that mounts to that volume and then use that PVC in my pod, but I am not sure if it's mounting to same host that pod comes up in or a different host.</p>
<p>YAML for Storage Class</p>
<pre><code>kind: StorageClass
metadata:
  name: local-path
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: Immediate
allowVolumeExpansion: true
reclaimPolicy: Delete
</code></pre>
<p>PV.yaml</p>
<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: redis-pv
  labels:
    type: local
spec:
  capacity:
    storage: 200Mi
  storageClassName: local-path
  claimRef:
    namespace: redis
    name: data-redis-0
  accessModes:
    - ReadWriteMany
  hostPath:
    path: &quot;/mnt2/data/redis&quot;
</code></pre>
<p>PVC.yaml</p>
<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: data-redis-0
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 200Mi
  storageClassName: local-path
</code></pre>
<p>no when i am trying to schedule a pod the storage is also getting mounted on the same node instead</p>

Avinav gupta
<p><strong>you are using local path you can not do it.</strong></p>
<p>There is a different type of <strong>AccessMount</strong> ReadWriteMany, ReadWriteOnce, and ReadyWriteOnly with PVC.</p>
<blockquote>
<p>A PersistentVolumeClaim (PVC) is a request for storage by a user. It
is similar to a Pod. Pods consume node resources and PVCs consume PV
resources. Pods can request specific levels of resources (CPU and
Memory). Claims can request specific size and access modes (e.g., they
can be mounted ReadWriteOnce, ReadOnlyMany or ReadWriteMany, see
AccessModes).</p>
</blockquote>
<p>Read More at : <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/storage/persistent-volumes/</a></p>
<p>Yes you can mount the multiple PODs to a single <strong>PVC</strong> but in that case, you have to use the ReadWriteMany. Most people use the NFS or EFS for this type of use case.</p>
<p>EBS is <strong>ReadWriteOnce</strong>, so it won't be possible to use the <strong>EBS</strong> in your case. you have to either use NFS or EFS.</p>
<p>you can use <strong>GlusterFs</strong> in the back it will be provisioning <strong>EBS volume</strong>. <strong>GlusterFS</strong> support <strong>ReadWriteMany</strong> and it will be faster compared to <strong>EFS</strong> as it's block storage (SSD).</p>
<p>For ReadWiteMany you can also checkout : <a href="https://min.io/" rel="nofollow noreferrer">https://min.io/</a></p>
<p>Find access mode details here : <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes</a></p>
