<p>I am running my docker containers with the help of kubernetes cluster on AWS EKS. Two of my docker containers are using shared volume and both of these containers are running inside two different pods. So I want a common volume which can be used by both the pods on aws.</p>

<p>I created an EFS volume and mounted. I am following link to create <code>PersistentVolumeClaim</code>. But I am getting timeout error when <code>efs-provider</code> pod trying to attach mounted EFS volume space. <code>VolumeId</code>, region are correct only. </p>

<p>Detailed Error message for Pod describe: </p>

<blockquote>
  <p>timeout expired waiting for volumes to attach or mount for pod "default"/"efs-provisioner-55dcf9f58d-r547q". list of unmounted volumes=[pv-volume]. list of unattached volumes=[pv-volume default-token-lccdw] <br>
  MountVolume.SetUp failed for volume "pv-volume" : mount failed: exit status 32</p>
</blockquote>

<p>AWS EFS uses NFS type volume plugin, and  As per 
<a href="https://kubernetes.io/docs/concepts/storage/storage-classes/" rel="nofollow noreferrer">Kubernetes Storage Classes</a>
NFS volume plugin does not come with internal Provisioner like EBS.</p>

<p>So the steps will be:</p>

<ol>
<li>Create an external Provisioner for NFS volume plugin.</li>
<li>Create a storage class.</li>
<li>Create one volume claim.</li>
<li><p>Use volume claim in Deployment.</p>

<ul>
<li><p>In the configmap section change the file.system.id: and aws.region: to match the details of the EFS you created.</p></li>
<li><p>In the deployment section change the server: to the DNS endpoint of the EFS you created.</p></li>
</ul></li>
</ol>

<hr>

<pre><code>---
apiVersion: v1
kind: ConfigMap
metadata:
  name: efs-provisioner
data:
  file.system.id: yourEFSsystemid
  aws.region: regionyourEFSisin
  provisioner.name: example.com/aws-efs

---
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
  name: efs-provisioner
spec:
  replicas: 1
  strategy:
    type: Recreate 
  template:
    metadata:
      labels:
        app: efs-provisioner
    spec:
      containers:
        - name: efs-provisioner
          image: quay.io/external_storage/efs-provisioner:latest
          env:
            - name: FILE_SYSTEM_ID
              valueFrom:
                configMapKeyRef:
                  name: efs-provisioner
                  key: file.system.id
            - name: AWS_REGION
              valueFrom:
                configMapKeyRef:
                  name: efs-provisioner
                  key: aws.region
            - name: PROVISIONER_NAME
              valueFrom:
                configMapKeyRef:
                  name: efs-provisioner
                  key: provisioner.name
          volumeMounts:
            - name: pv-volume
              mountPath: /persistentvolumes
      volumes:
        - name: pv-volume
          nfs:
            server: yourEFSsystemID.efs.yourEFSregion.amazonaws.com
            path: /

---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: aws-efs
provisioner: example.com/aws-efs

---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: efs
  annotations:
    volume.beta.kubernetes.io/storage-class: "aws-efs"
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 1Mi
</code></pre>

<p>For more explanation and details go to <a href="https://github.com/kubernetes-incubator/external-storage/tree/master/aws/efs" rel="nofollow noreferrer">https://github.com/kubernetes-incubator/external-storage/tree/master/aws/efs</a></p>
