<p>I have an EKS cluster of 2 nodes which I created by the below command</p>
<pre><code>time eksctl create cluster --name=eks-spinnaker --ssh-access=true --ssh-public-key=testkeyG --nodes=2 --region=ap-southeast-2 --write-kubeconfig=false
</code></pre>
<p>I then ssh to the two newly created VM and added, EFS as below so I can use it for PersistenceVolume</p>
<pre><code>sudo  yum update -y
EFS_FILE_SYSTEM_DNS_NAME=fs-efb24ad7.efs.ap-southeast-2.amazonaws.com
sudo mkdir /efs-data
sudo mount -t nfs -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport $EFS_FILE_SYSTEM_DNS_NAME:/ /efs-data
df -Ph
cd /efs-data/
chmod -R 777 .
touch abc
</code></pre>
<p>I see the below on both nodes clearly:
<em>Node01</em></p>
<pre><code>[ec2-user@ip-192-168-74-31 efs-data]$ df -Ph |grep -i efs
fs-efb24ad7.efs.ap-southeast-2.amazonaws.com:/  8.0E     0  8.0E   0% /efs-data
[ec2-user@ip-192-168-74-31 efs-data]$

</code></pre>
<p><em>Node02</em></p>
<pre><code>[ec2-user@ip-192-168-21-167 efs-data]$ df -Ph |grep -i efs
fs-efb24ad7.efs.ap-southeast-2.amazonaws.com:/  8.0E     0  8.0E   0% /efs-data
[ec2-user@ip-192-168-21-167 efs-data]$
</code></pre>
<p>I am now spinning up my Jenkins as k8s deployment and to use that /efs-data as PV but having no luck.</p>
<pre><code>[centos@ip-10-0-0-61 storage]$ kubectl get pv,pvc -n jenkins
NAME                      CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM               STORAGECLASS   REASON   AGE
persistentvolume/efs-pv   5Gi        RWX            Retain           Bound    jenkins/efs-claim   efs-sc                  7h6m

NAME                              STATUS   VOLUME   CAPACITY   ACCESS MODES   STORAGECLASS   AGE
persistentvolumeclaim/efs-claim   Bound    efs-pv   5Gi        RWX            efs-sc         7h6m
[centos@ip-10-0-0-61 storage]$
</code></pre>
<p>Added helm repo and installed it</p>
<pre><code>helm repo add jenkinsci https://charts.jenkins.io
helm install jenkins jenkinsci/jenkins --set rbac.create=true,master.servicePort=8081,master.serviceType=LoadBalancer,persistence.existingClaim=efs-claim -n jenkins
</code></pre>
<p>Unfortunately, the <code>kubectl describe pods &lt;od name&gt; -n jenkins</code> gives no clue as to what is going wrong</p>
<pre><code>kubectl describe pods jenkins-c7498bcdf-4jk9w -n jenkins


Events:
  Type     Reason       Age                    From                                                        Message
  ----     ------       ----                   ----                                                        -------
  Warning  FailedMount  26m (x6 over 117m)     kubelet, ip-192-168-21-167.ap-southeast-2.compute.internal  Unable to attach or mount volumes: unmounted volumes=[jenkins-home], unattached volumes=[plugin-dir jenkins-token-xgzf4 sc-config-volume tmp jenkins-home jenkins-config plugins]: timed out waiting for the condition
  Warning  FailedMount  17m (x8 over 110m)     kubelet, ip-192-168-21-167.ap-southeast-2.compute.internal  Unable to attach or mount volumes: unmounted volumes=[jenkins-home], unattached volumes=[plugins plugin-dir jenkins-token-xgzf4 sc-config-volume tmp jenkins-home jenkins-config]: timed out waiting for the condition
  Warning  FailedMount  6m12s (x11 over 128m)  kubelet, ip-192-168-21-167.ap-southeast-2.compute.internal  Unable to attach or mount volumes: unmounted volumes=[jenkins-home], unattached volumes=[tmp jenkins-home jenkins-config plugins plugin-dir jenkins-token-xgzf4 sc-config-volume]: timed out waiting for the condition
  Warning  FailedMount  110s (x72 over 132m)   kubelet, ip-192-168-21-167.ap-southeast-2.compute.internal  MountVolume.SetUp failed for volume &quot;efs-pv&quot; : kubernetes.io/csi: mounter.SetupAt failed: rpc error: code = Internal desc = Could not mount &quot;fs-efb24ad7:/efs-data&quot; at &quot;/var/lib/kubelet/pods/66e53953-8678-404c-beb6-d21908cc8dee/volumes/kubernetes.io~csi/efs-pv/mount&quot;: mount failed: exit status 32
Mounting command: mount
Mounting arguments: -t efs fs-efb24ad7:/efs-data /var/lib/kubelet/pods/66e53953-8678-404c-beb6-d21908cc8dee/volumes/kubernetes.io~csi/efs-pv/mount
Output: mount.nfs4: mounting fs-efb24ad7.efs.ap-southeast-2.amazonaws.com:/efs-data failed, reason given by server: No such file or directory

</code></pre>
<p>So, I ssh on one of the EKS clusters where I have mounted EFS, there  also I get the same errors</p>
<pre><code>Sep  5 16:19:17 ip-192-168-21-167 kubelet: {&quot;level&quot;:&quot;info&quot;,&quot;ts&quot;:&quot;2020-09-05T16:19:17.390Z&quot;,&quot;caller&quot;:&quot;/usr/local/go/src/runtime/proc.go:203&quot;,&quot;msg&quot;:&quot;CNI Plugin version: v1.6.3 ...&quot;}
Sep  5 16:19:22 ip-192-168-21-167 kubelet: {&quot;level&quot;:&quot;info&quot;,&quot;ts&quot;:&quot;2020-09-05T16:19:22.415Z&quot;,&quot;caller&quot;:&quot;/usr/local/go/src/runtime/proc.go:203&quot;,&quot;msg&quot;:&quot;CNI Plugin version: v1.6.3 ...&quot;}
Sep  5 16:19:22 ip-192-168-21-167 su: (to root) ec2-user on pts/0
Sep  5 16:19:27 ip-192-168-21-167 kubelet: {&quot;level&quot;:&quot;info&quot;,&quot;ts&quot;:&quot;2020-09-05T16:19:27.440Z&quot;,&quot;caller&quot;:&quot;/usr/local/go/src/runtime/proc.go:203&quot;,&quot;msg&quot;:&quot;CNI Plugin version: v1.6.3 ...&quot;}
Sep  5 16:19:27 ip-192-168-21-167 kubelet: I0905 16:19:27.732162    3861 csi_attacher.go:310] kubernetes.io/csi: attacher.MountDevice STAGE_UNSTAGE_VOLUME capability not set. Skipping MountDevice...
Sep  5 16:19:27 ip-192-168-21-167 kubelet: I0905 16:19:27.732616    3861 operation_generator.go:587] MountVolume.MountDevice succeeded for volume &quot;efs-pv&quot; (UniqueName: &quot;kubernetes.io/csi/efs.csi.aws.com^fs-efb24ad7:/efs-data&quot;) pod &quot;jenkins-c7498bcdf-4jk9w&quot; (UID: &quot;66e53953-8678-404c-beb6-d21908cc8dee&quot;) device mount path &quot;/var/lib/kubelet/plugins/kubernetes.io/csi/pv/efs-pv/globalmount&quot;
Sep  5 16:19:29 ip-192-168-21-167 kubelet: E0905 16:19:29.715185    3861 nestedpendingoperations.go:301] Operation for &quot;{volumeName:kubernetes.io/csi/efs.csi.aws.com^fs-efb24ad7:/efs-data podName: nodeName:}&quot; failed. No retries permitted until 2020-09-05 16:21:31.715151408 +0000 UTC m=+86869.996160364 (durationBeforeRetry 2m2s). Error: &quot;MountVolume.SetUp failed for volume \&quot;efs-pv\&quot; (UniqueName: \&quot;kubernetes.io/csi/efs.csi.aws.com^fs-efb24ad7:/efs-data\&quot;) pod \&quot;jenkins-c7498bcdf-4jk9w\&quot; (UID: \&quot;66e53953-8678-404c-beb6-d21908cc8dee\&quot;) : kubernetes.io/csi: mounter.SetupAt failed: rpc error: code = Internal desc = Could not mount \&quot;fs-efb24ad7:/efs-data\&quot; at \&quot;/var/lib/kubelet/pods/66e53953-8678-404c-beb6-d21908cc8dee/volumes/kubernetes.io~csi/efs-pv/mount\&quot;: mount failed: exit status 32\nMounting command: mount\nMounting arguments: -t efs fs-efb24ad7:/efs-data /var/lib/kubelet/pods/66e53953-8678-404c-beb6-d21908cc8dee/volumes/kubernetes.io~csi/efs-pv/mount\nOutput: mount.nfs4: mounting fs-efb24ad7.efs.ap-southeast-2.amazonaws.com:/efs-data failed, reason given by server: No such file or directory\n&quot;
Sep  5 16:19:32 ip-192-168-21-167 kubelet: {&quot;level&quot;:&quot;info&quot;,&quot;ts&quot;:&quot;2020-09-05T16:19:32.458Z&quot;,&quot;caller&quot;:&quot;/usr/local/go/src/runtime/proc.go:203&quot;,&quot;msg&quot;:&quot;CNI Plugin version: v1.6.3 ...&quot;}
Sep  5 16:19:35 ip-192-168-21-167 dhclient[2857]: XMT: Solicit on eth0, interval 111090ms.
Sep  5 16:19:37 ip-192-168-21-167 kubelet: {&quot;level&quot;:&quot;info&quot;,&quot;ts&quot;:&quot;2020-09-05T16:19:37.477Z&quot;,&quot;caller&quot;:&quot;/usr/local/go/src/runtime/proc.go:203&quot;,&quot;msg&quot;:&quot;CNI Plugin version: v1.6.3 ...&quot;}

</code></pre>
<p>The permissions on <em>/efs-data</em> are below:</p>
<pre><code>[root@ip-192-168-21-167 ~]# ls -ld /efs-data/
drwxrwxrwx 4 root root 6144 Sep  5 13:19 /efs-data/
[root@ip-192-168-21-167 ~]#

</code></pre>
<p>Exhausted... Please let me know what the issue is and how to have it resolved...</p>

<p>The issue is that <code>/efs-data</code> doesn't eactually exist in your EFS drive. Jenkins is trying to mount that directory (from the log outout):</p>
<pre class="lang-sh prettyprint-override"><code>-t efs fs-efb24ad7:/efs-data /var/lib/kubelet/pods/66e53953-8678-404c-beb6-d21908cc8dee/volumes/kubernetes.io~csi/efs-pv/mount
</code></pre>
<p>So the message:</p>
<pre class="lang-sh prettyprint-override"><code>Output: mount.nfs4: mounting fs-efb24ad7.efs.ap-southeast-2.amazonaws.com:/efs-data failed, reason given by server: No such file or directory
</code></pre>
<p>is correct.</p>
<p>When you run:</p>
<pre class="lang-sh prettyprint-override"><code>sudo mount -t nfs -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport $EFS_FILE_SYSTEM_DNS_NAME:/ /efs-data
</code></pre>
<p>it actually mounts <code>/</code> on your local <code>/efs-data</code> directory, but that's not the EFS directory. For that to exist you can simply run:</p>
<pre class="lang-sh prettyprint-override"><code>cd /efs-data
mkdir efs-data
</code></pre>
<p>Then <code>/efs-data</code> will actually exist in the EFS volume.</p>
<p>✌️</p>
