<p>I am trying to create a kubernetes NFS volume on Google Container Engine (GKE) and get it used by a deployment.</p>

<p>I did this in several steps as it shown in this github repository <a href="https://github.com/mappedinn/kubernetes-nfs-volume-on-gke" rel="nofollow noreferrer">kubernetes-nfs-volume-on-gke</a>:</p>

<ol>
<li>Create a GKE cluster and GCE persistent disk</li>
<li>Config the context for the kubectl to deal with the GKE cluster</li>
<li>Creation of the PersistentVolume (PV) and the PersistentVolumeClaim (PVC)</li>
<li>Creation of an NFS server</li>
<li>Create a service for the NFS server to expose it (the IP address of that service is used for the creation of the NFS PV and NFS PVC)</li>
<li>Creation of NFS volume</li>
<li>Create a Deployment of a busybox for checking the NFS volume is accessible.</li>
</ol>

<p>After fellowing these step, this is the obtained error:</p>

<pre><code>$ kubectl describe pods  nfs-busybox-2762569073-lhb5p
Name:       nfs-busybox-2762569073-lhb5p
Namespace:  default
Node:       gke-mappedinn-cluster-default-pool-f94cb0d4-fmfb/10.240.0.3
Start Time: Wed, 12 Apr 2017 04:12:20 +0400
Labels:     name=nfs-busybox
        pod-template-hash=2762569073
Annotations:    kubernetes.io/created-by={"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicaSet","namespace":"default","name":"nfs-busybox-2762569073","uid":"b1e523ae-1f14-11e7-a084-42010a8e0...
        kubernetes.io/limit-ranger=LimitRanger plugin set: cpu request for container busybox
Status:     Pending
IP:     
Controllers:    ReplicaSet/nfs-busybox-2762569073
Containers:
  busybox:
    Container ID:
    Image:      busybox
    Image ID:       
    Port:       
    Command:
      sh
      -c
      while true; do date &gt; /mnt/index.html; hostname &gt;&gt; /mnt/index.html; sleep $(($RANDOM % 5 + 5)); done
    State:      Waiting
      Reason:       ContainerCreating
    Ready:      False
    Restart Count:  0
    Requests:
      cpu:      100m
    Environment:    &lt;none&gt;
    Mounts:
      /mnt from my-pvc-nfs (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-20n4b (ro)
Conditions:
  Type      Status
  Initialized   True
  Ready     False
  PodScheduled  True
Volumes:
  my-pvc-nfs:
    Type:   PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  nfs
    ReadOnly:   false
  default-token-20n4b:
    Type:   Secret (a volume populated by a Secret)
    SecretName: default-token-20n4b
    Optional:   false
QoS Class:  Burstable
Node-Selectors: &lt;none&gt;
Tolerations:    &lt;none&gt;
Events:
  FirstSeen LastSeen    Count   From                                SubObjectPath   Type        Reason      Message
  --------- --------    -----   ----                                -------------   --------    ------      -------
  5m        5m      1   default-scheduler                               Normal      Scheduled   Successfully assigned nfs-busybox-2762569073-lhb5p to gke-mappedinn-cluster-default-pool-f94cb0d4-fmfb
  3m        48s     2   kubelet, gke-mappedinn-cluster-default-pool-f94cb0d4-fmfb           Warning     FailedMount Unable to mount volumes for pod "nfs-busybox-2762569073-lhb5p_default(b1e7c901-1f14-11e7-a084-42010a8e0116)": timeout expired waiting for volumes to attach/mount for pod "default"/"nfs-busybox-2762569073-lhb5p". list of unattached/unmounted volumes=[my-pvc-nfs]
  3m        48s     2   kubelet, gke-mappedinn-cluster-default-pool-f94cb0d4-fmfb           Warning     FailedSync  Error syncing pod, skipping: timeout expired waiting for volumes to attach/mount for pod "default"/"nfs-busybox-2762569073-lhb5p". list of unattached/unmounted volumes=[my-pvc-nfs]
  37s       37s     1   kubelet, gke-mappedinn-cluster-default-pool-f94cb0d4-fmfb           Warning     FailedMount MountVolume.SetUp failed for volume "kubernetes.io/nfs/b1e7c901-1f14-11e7-a084-42010a8e0116-nfs" (spec.Name: "nfs") pod "b1e7c901-1f14-11e7-a084-42010a8e0116" (UID: "b1e7c901-1f14-11e7-a084-42010a8e0116") with: mount failed: exit status 32
Mounting command: /home/kubernetes/bin/mounter
Mounting arguments: 10.247.250.208:/exports /var/lib/kubelet/pods/b1e7c901-1f14-11e7-a084-42010a8e0116/volumes/kubernetes.io~nfs/nfs nfs []
Output: Running mount using a rkt fly container
run: group "rkt" not found, will use default gid when rendering images 
</code></pre>

<p>In the kubernetes dashboard, the error is as follows:</p>

<p><strong>Unable to mount volumes for pod "nfs-busybox-2762569073-lhb5p_default(b1e7c901-1f14-11e7-a084-42010a8e0116)": timeout expired waiting for volumes to attach/mount for pod "default"/"nfs-busybox-2762569073-lhb5p". list of unattached/unmounted volumes=[my-pvc-nfs]</strong></p>

<p><strong>Error syncing pod, skipping: timeout expired waiting for volumes to attach/mount for pod "default"/"nfs-busybox-2762569073-lhb5p". list of unattached/unmounted volumes=[my-pvc-nfs]</strong></p>

<p>Have I missed something?</p>

<p>Thanks,</p>

<p>This <a href="https://github.com/kubernetes/kubernetes/issues/33447#issuecomment-275198328" rel="nofollow noreferrer">comment</a> in the <a href="https://github.com/kubernetes/kubernetes/issues/33447" rel="nofollow noreferrer">issue</a> on kubernetes seems to solve this NFS issue on GKE.</p>
<p>Qutoing that comment:</p>
<blockquote>
<p>Edit <code>examples/volumes/nfs/nfs-pv.yaml</code> change the last line to path: <code>&quot;/&quot;</code>.</p>
<p>Edit <code>examples/volumes/nfs/nfs-server-rc.yaml</code> change the image to the one that enabled NFSv4 image: <code>gcr.io/google_containers/volume-nfs:0.8</code></p>
</blockquote>
<p>Also there are other issues where this is tracked <a href="https://github.com/kubernetes/kubernetes/issues/24687" rel="nofollow noreferrer">here</a> and <a href="https://github.com/kubernetes/kubernetes/issues/44377" rel="nofollow noreferrer">here</a>.</p>
