I have a NAS Linux server on port 192.168.0.100
which contains the directory /mnt/virtual/media/
. Here is the directory structure:
ubuntu@linux-node-00:/mnt/virtual$ ls -altotal 16drwxrwsrwx 3 nobody nogroup 4096 Jun 7 12:37 .drwxr-xr-x 10 root root 4096 Jun 25 2021 ..drwxrwsrwx+ 4 ubuntu ubuntu 4096 Jun 9 17:29 mediaubuntu@linux-node-00:/mnt/virtual$ cd media/ubuntu@linux-node-00:/mnt/virtual/media$ ls -altotal 32drwxrwsrwx+ 4 ubuntu ubuntu 4096 Jun 9 17:29 .drwxrwsrwx 3 nobody nogroup 4096 Jun 7 12:37 ..drwxrwsrwx 2 ubuntu ubuntu 4096 Jun 9 16:37 downloadsdrwxrwsrwx+ 2 ubuntu ubuntu 4096 Feb 8 2020 moviesdrwxrwsrwx+ 19 ubuntu ubuntu 4096 Sep 14 2021 tv
I then have a few other Linux servers which contain a Kubernetes cluster. These follow the IP range of 192.168.0.101
- 192.168.0.104
, with the main Kubernetes node with the IP 192.168.0.101
.
These nodes have access to the directories on the NAS server. I have tests this by create a file on each server making sure they appear in the NAS server. The directory structure for the main node is:
ubuntu@linux-node-01:/mnt$ ls -altotal 16drwxr-xr-x 3 root root 4096 Jun 9 17:33 .drwxr-xr-x 22 root root 4096 Jun 9 18:05 ..drwxrwsrwx 4 ubuntu gpio 4096 Jun 9 18:29 mediaubuntu@linux-node-01:/mnt$ cd media/ubuntu@linux-node-01:/mnt/media$ ls -altotal 32drwxrwsrwx 4 ubuntu gpio 4096 Jun 9 18:29 .drwxr-xr-x 3 root root 4096 Jun 9 17:33 ..drwxrwsrwx 2 ubuntu gpio 4096 Jun 9 17:37 downloadsdrwxrwsrwx 2 ubuntu gpio 4096 Feb 8 2020 moviesdrwxrwsrwx 19 ubuntu gpio 4096 Sep 14 2021 tv
Then in my Kubernetes cluster I have set up a few persistent volumes, and claims using the following:
apiVersion: v1kind: PersistentVolumemetadata: name: nfs-tv-pvspec: capacity: storage: 25Gi accessModes: - ReadWriteMany nfs: path: /mnt/media/tv server: 192.168.0.101---apiVersion: v1kind: PersistentVolumeClaimmetadata: name: nfs-tv-pvc namespace: cortanaspec: accessModes: - ReadWriteMany resources: requests: storage: 25Gi---apiVersion: v1kind: PersistentVolumemetadata: name: nfs-downloads-pvspec: capacity: storage: 25Gi accessModes: - ReadWriteMany nfs: path: /mnt/media/downloads server: 192.168.0.101---apiVersion: v1kind: PersistentVolumeClaimmetadata: name: nfs-downloads-pvc namespace: cortanaspec: accessModes: - ReadWriteMany resources: requests: storage: 25Gi
In my deployment I have the following:
... volumes: - name: config persistentVolumeClaim: claimName: nfs-config-pvc - name: tv persistentVolumeClaim: claimName: nfs-tv-pvc - name: downloads persistentVolumeClaim: claimName: nfs-downloads-pvc... volumeMounts: - name: config mountPath: /config - name: tv mountPath: /tv - name: downloads mountPath: /downloads...
I am getting the following errors:
MountVolume.SetUp failed for volume "nfs-tv-pv" : mount failed: exit status 32 Mounting command: mount Mounting arguments: -t nfs 192.168.0.101:/mnt/media/tv /var/snap/microk8s/common/var/lib/kubelet/pods/395b3cda-d877-4c2e-b4aa-f8d61b97c4fd/volumes/kubernetes.io~nfs/nfs-tv-pv Output: mount.nfs: access denied by server while mounting 192.168.0.101:/mnt/media/tv
MountVolume.SetUp failed for volume "nfs-downloads-pv" : mount failed: exit status 32 Mounting command: mount Mounting arguments: -t nfs 192.168.0.101:/mnt/media/downloads /var/snap/microk8s/common/var/lib/kubelet/pods/395b3cda-d877-4c2e-b4aa-f8d61b97c4fd/volumes/kubernetes.io~nfs/nfs-downloads-pv Output: mount.nfs: access denied by server while mounting 192.168.0.101:/mnt/media/downloads
I don't know why permissions seem to be fine on the node itself but is unable to mount a directory in the pod.