<p>I am having the below Pod definition.</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: mongodb
spec:
  volumes:
  - name: mongodb-data
    awsElasticBlockStore:
      volumeID: vol-0c0d9800c22f8c563
      fsType: ext4
  containers:
  - image: mongo
    name: mongodb
    volumeMounts:
    - name: mongodb-data
      mountPath: /data/db
    ports:
    - containerPort: 27017
      protocol: TCP
</code></pre>

<p>I have created volumne in AWS and tried to mount to the container. The container is not starting.</p>

<pre><code>kubectl get po
NAME      READY   STATUS              RESTARTS   AGE
mongodb   0/1     ContainerCreating   0          6m57s
</code></pre>

<p>When I created the volume and assigned it to a Availability zone where the node is running and and the pod was scheduled on that node, the volume was mounted successfully. If the pod is not scheduled on the node, the mount fails. How can I make sure that the volume can be accessed by all the nodes</p>

<p>According to the <a href="https://kubernetes.io/docs/concepts/storage/volumes/#awselasticblockstore" rel="nofollow noreferrer">documentation</a>:</p>

<blockquote>
  <p>There are some restrictions when using an awsElasticBlockStore volume:</p>
  
  <ul>
  <li>the nodes on which Pods are running must be AWS EC2 instances</li>
  <li>those instances need to be in the same region and availability-zone as the EBS volume</li>
  <li>EBS only supports a single EC2 instance mounting a volume</li>
  </ul>
</blockquote>

<p>Make sure all of the above are met. If your nodes are in different zones than you might need to create additional EBS volumes, for example:</p>

<pre><code>aws ec2 create-volume --availability-zone=eu-west-1a --size=10 --volume-type=gp2
</code></pre>

<p>Please let me know if that helped.</p>
