<p>How do you mount the FileStorage to the Kubernetes pod in GCP</p>

<p>I did follow the documentation but the pods still pending</p>

<p>I did:</p>

<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: &lt;some name&gt;
spec:
  capacity:
    storage: 50Gi
  accessModes:
  - ReadWriteMany
  nfs:
    path: /
    server: &lt;filestorage_ip with this format xx.xxx.xxx.xx&gt;
</code></pre>

<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: &lt;some name&gt;
  namespace: &lt;some name&gt;
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: ""
  resources:
    requests:
      storage: 50Gi
</code></pre>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: &lt;some name&gt;
  name: &lt;some name&gt;
  labels:
    app: &lt;some name&gt;
spec:
  replicas: 2
  selector:
    matchLabels:
      app: &lt;some name&gt;
  template:
    metadata:
      labels:
        app: &lt;some name&gt;
    spec:
      containers:
      - name: &lt;some name&gt;
        image: gcr.io/somepath/&lt;some name&gt;@sha256:&lt;some hash&gt;
        ports:
        - containerPort: 80 
        volumeMounts:
          - name: &lt;some name&gt;
            mountPath: /var/www/html
        imagePullPolicy: Always
      restartPolicy: Always
      volumes:
        - name: &lt;some name&gt;
          persistentVolumeClaim:
            claimName: &lt;some name&gt;
            readOnly: false
</code></pre>

<p>Running <code>kubectl -n &lt;some name&gt; describe pods</code> returns:</p>

<pre class="lang-sh prettyprint-override"><code>Events:
  Type     Reason       Age                     From                                                        Message
  ----     ------       ----                    ----                                                        -------
  Warning  FailedMount  23m (x52 over 3h21m)    kubelet, gke-&lt;some name&gt;-default-pool-&lt;some hash&gt;  Unable to mount volumes for pod "&lt;some name&gt;-&lt;some hash&gt;_&lt;some name&gt;(&lt;some hash&gt;)": timeout expired waiting for volumes to attach or mount for pod "&lt;some name&gt;"/"&lt;some name&gt;-&lt;some hash&gt;". list of unmounted volumes=[&lt;some name&gt;-persistent-storage]. list of unattached volumes=[&lt;some name&gt;-persistent-storage default-token-&lt;some hash&gt;]
  Warning  FailedMount  3m5s (x127 over 3h21m)  kubelet, gke-&lt;some name&gt;-default-pool-&lt;some hash&gt;  (combined from similar events): MountVolume.SetUp failed for volume "&lt;some name&gt;-storage" : mount failed: exit status 1
Mounting command: systemd-run
Mounting arguments: --description=Kubernetes transient mount for /var/lib/kubelet/pods/&lt;some path&gt;/volumes/kubernetes.io~nfs/&lt;some name&gt;-storage --scope -- /home/kubernetes/containerized_mounter/mounter mount -t nfs &lt;filestorage_ip with this format xx.xxx.xxx.xx&gt;:/ /var/lib/kubelet/pods/&lt;some hash&gt;/volumes/kubernetes.io~nfs/&lt;some name&gt;-storage
Output: Running scope as unit: run-&lt;some hash&gt;.scope
Mount failed: mount failed: exit status 32
Mounting command: chroot
Mounting arguments: [/home/kubernetes/containerized_mounter/rootfs mount -t nfs &lt;filestorage_ip with this format xx.xxx.xxx.xx&gt;:/ /var/lib/kubelet/pods/&lt;some hash&gt;/volumes/kubernetes.io~nfs/&lt;some name&gt;-storage]
Output: mount.nfs: access denied by server while mounting &lt;filestorage_ip with this format xx.xxx.xxx.xx&gt;:/
</code></pre>

<p>It seems that the pod can't access de the IP of the FileStorage service
In the documentation says that needs to be on the same VPC </p>

<p>"Authorized network *
Filestore instances can only be accessed from machines on an authorized VPC network. Select the network from which you need access."</p>

<p>But I don't know how to add the Kubernetes cluster to the VPC</p>

<p>Any suggestions?</p>

Tai Kamilla
<p>I found the problem</p>

<p>The <code>PersistentVolume</code> can't be mount in <code>path: /</code>
It needs the "Fileshare properties" field that makes you fill in on the creation
Now works with multiple pods!</p>
