<p>I'm very new to Kubernetes, and trying to get node-red running on a small cluster of raspberry pi's
I happily managed that, but noticed that once the cluster is powered down, next time I bring it up, the flows in node-red have vanished.</p>

<p>So, I've create a NFS share on a freenas box on my local network and can mount it from another RPI, so I know the permissions work.</p>

<p>However I cannot get my mount to work in a kubernetes deployment.</p>

<p>Any help as to where I have gone wrong please?</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: node-red
  labels:
    app: node-red
spec:
  replicas: 1
  selector:
    matchLabels:
      app: node-red
  template:
    metadata:
      labels:
        app: node-red
    spec:
      containers:
      - name: node-red
        image: nodered/node-red:latest
        ports:
        - containerPort: 1880
          name: node-red-ui
        securityContext:
          privileged: true
        volumeMounts:
        - name: node-red-data
          mountPath: /data
        env:
        - name: NODE_NAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
        - name: TZ
          value: Europe/London
      volumes:
         - name: node-red-data
      nfs:
         server: 192.168.1.96
         path: /mnt/Pool1/ClusterStore/nodered
</code></pre>

<p>The error I am getting is</p>

<blockquote>
<pre><code>error: error validating "node-red-deploy.yml": error validating data: 
ValidationError(Deployment.spec.template.spec): unknown field "nfs" in io.k8s.api.core.v1.PodSpec; if 
you choose to ignore these errors, turn validation off with --validate=false
</code></pre>
</blockquote>

<p>New Information</p>

<p>I now have the following</p>

<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: clusterstore-nodered
  labels:
    type: nfs
spec:
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteMany
  nfs:
    path: /mnt/Pool1/ClusterStore/nodered
    server: 192.168.1.96 
  persistentVolumeReclaimPolicy: Recycle
</code></pre>

<p>claim.yaml</p>

<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: clusterstore-nodered-claim
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 1Gi
</code></pre>

<p>Now when I start the deployment it waits at pending forever and I see the following the the events for the PVC</p>

<p>Events:
  Type     Reason                Age                   From                                                                                                Message
  ----     ------                ----                  ----                                                                                                -------
  Normal   WaitForFirstConsumer  5m47s (x7 over 7m3s)  persistentvolume-controller                                                                         waiting for first consumer to be created before binding
  Normal   Provisioning          119s (x5 over 5m44s)  rancher.io/local-path_local-path-provisioner-58fb86bdfd-rtcls_506528ac-afd0-11ea-930d-52d0b85bb2c2  External provisioner is provisioning volume for claim "default/clusterstore-nodered-claim"
  Warning  ProvisioningFailed    119s (x5 over 5m44s)  rancher.io/local-path_local-path-provisioner-58fb86bdfd-rtcls_506528ac-afd0-11ea-930d-52d0b85bb2c2  failed to provision volume with StorageClass "local-path": Only support ReadWriteOnce access mode</p>

<p>Normal   ExternalProvisioning  92s (x19 over 5m44s)  persistentvolume-controller
                                                                         waiting for a volume to be created, either by external provisioner "rancher.io/local-path" or manually created by system administrator</p>

<p>I assume that this is becuase I don't have a nfs provider, in fact if I do kubectl get storageclass I only see local-path</p>

<p>New question, how do I a add a storageclass for NFS?  A little googleing around has left me without a clue.</p>

Peter Page
<p><strong>In the stated Tutorial there are basically these steps to fulfill:</strong></p>
<p>1.</p>
<pre><code>showmount -e 192.168.1.XY 
</code></pre>
<p>to check if the share is reachable from outside the NAS</p>
<p>2.</p>
<pre><code>helm install nfs-provisioner stable/nfs-client-provisioner --set nfs.server=192.168.1.**XY** --set nfs.path=/samplevolume/k3s --set image.repository=quay.io/external_storage/nfs-client-provisioner-arm
</code></pre>
<p>Whereas you replace the IP with your NFS Server and the NFS path with your specific Path on your synology (both should be visible from your <em><strong>showmount -e IP</strong></em> command</p>
<p><strong>Update 23.02.2021</strong>
It seems that you have to use another Chart and Image too:</p>
<pre><code>helm install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner --set nfs.server=192.168.1.**XY** --set nfs.path=/samplevolume/k3s --set image.repository=gcr.io/k8s-staging-sig-storage/nfs-subdir-external-provisioner
</code></pre>
<ol start="3">
<li>kubectl get storageclass</li>
</ol>
<p>To check if the storageclass now exists</p>
<p>4.</p>
<pre><code>kubectl patch storageclass nfs-client -p '{&quot;metadata&quot;: {&quot;annotations&quot;:{&quot;storageclass.kubernetes.io/is-default-class&quot;:&quot;true&quot;}}}' &amp;&amp; kubectl patch storageclass local-path -p '{&quot;metadata&quot;: {&quot;annotations&quot;:{&quot;storageclass.kubernetes.io/is-default-class&quot;:&quot;false&quot;}}}'
</code></pre>
<p>To configure the new Storage class as &quot;default&quot;. Replace nfs-client and local-path with what kubectl get storageclass tells</p>
<p>5.</p>
<pre><code>kubectl get storageclass
</code></pre>
<p>Final check, if it's marked as &quot;default&quot;</p>
