kubernetes-sigs / nfs-subdir-external-provisioner

Dynamic sub-dir volume provisioner on a remote NFS server.
Apache License 2.0
2.55k stars 755 forks source link

NFS mounts not working exit status 32 #342

Open robgardien opened 4 months ago

robgardien commented 4 months ago

When using NFS subdir external provisioner I receive the following error:

MountVolume.SetUp failed for volume "pvc-bee16797-fef3-4baa-b79f-5addf4455af1" : mount failed: exit status 32 Mounting command: mount Mounting arguments: -t nfs 192.168.2.173:/volume1/rancher/transmission-transmission-config-pvc-bee16797-fef3-4baa-b79f-5addf4455af1 /var/snap/microk8s/common/var/lib/kubelet/pods/485b6ad3-8e01-4cc6-8ebf-5d0945fd08d0/volumes/kubernetes.io~nfs/pvc-bee16797-fef3-4baa-b79f-5addf4455af1

Output: mount: /var/snap/microk8s/common/var/lib/kubelet/pods/485b6ad3-8e01-4cc6-8ebf-5d0945fd08d0/volumes/kubernetes.io~nfs/pvc-bee16797-fef3-4baa-b79f-5addf4455af1: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount. helper program.

I can confirm I have installed mount.nfs (apt install nfs-common) so I don't know how to solve this error. Thank you for your help

thisisharrsh commented 3 months ago

The error message you're seeing indicates that there might be an issue with the NFS configuration or the environment in which the NFS subdir external provisioner is running.

thisisharrsh commented 3 months ago

It would be helpful if you could provide some steps to reproduce this issue.

stenzing commented 2 months ago

HI! I'm facing the same issue after going through the guide on https://www.itwonderlab.com/kubernetes-nfs/

`stenzing@deb-test-1:~$ kubectl describe pod nfs-subdir-external-provisioner-d64f95ffd-jdcdc -n nfs Name: nfs-subdir-external-provisioner-d64f95ffd-jdcdc Namespace: nfs Priority: 0 Service Account: nfs-subdir-external-provisioner Node: w01.localcluster/192.168.1.230 Start Time: Sun, 21 Jul 2024 10:17:51 -0500 Labels: app=nfs-subdir-external-provisioner pod-template-hash=d64f95ffd release=nfs-subdir-external-provisioner Annotations: Status: Pending IP: IPs: Controlled By: ReplicaSet/nfs-subdir-external-provisioner-d64f95ffd Containers: nfs-subdir-external-provisioner: Container ID: Image: registry.k8s.io/sig-storage/nfs-subdir-external-provisioner:v4.0.2 Image ID: Port: Host Port: State: Waiting Reason: ContainerCreating Ready: False Restart Count: 0 Environment: PROVISIONER_NAME: cluster.local/nfs-subdir-external-provisioner NFS_SERVER: 192.168.1.202 NFS_PATH: /nfsdata Mounts: /persistentvolumes from nfs-subdir-external-provisioner-root (rw) /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-5ctgg (ro) Conditions: Type Status PodReadyToStartContainers False Initialized True Ready False ContainersReady False PodScheduled True Volumes: nfs-subdir-external-provisioner-root: Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace) ClaimName: pvc-nfs-subdir-external-provisioner ReadOnly: false kube-api-access-5ctgg: Type: Projected (a volume that contains injected data from multiple sources) TokenExpirationSeconds: 3607 ConfigMapName: kube-root-ca.crt ConfigMapOptional: DownwardAPI: true QoS Class: BestEffort Node-Selectors: Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s node.kubernetes.io/unreachable:NoExecute op=Exists for 300s Events: Type Reason Age From Message


Normal Scheduled 20s default-scheduler Successfully assigned nfs/nfs-subdir-external-provisioner-d64f95ffd-jdcdc to w01.localcluster Warning FailedMount 4s (x6 over 20s) kubelet MountVolume.SetUp failed for volume "pv-nfs-subdir-external-provisioner" : mount failed: exit status 32 Mounting command: mount Mounting arguments: -t nfs -o hard=,nfsvers=4.1,noresvport=,retrans=2,rsize=1048576,timeo=600,wsize=1048576 192.168.1.202:/nfsdata /var/lib/kubelet/pods/3561da6b-bf9a-4c08-a370-0d4c39af419b/volumes/kubernetes.io~nfs/pv-nfs-subdir-external-provisioner Output: mount.nfs: an incorrect mount option was specified ` the nfs-common is installed on all nodes.

Then I checked on the nfs client documentation those arguments for the -o, and that was the issue on my side. after that I only had to set the storageclass as default and started working.

thisisharrsh commented 2 months ago

As we can observe, you're experiencing a FailedMount error due to incorrect NFS mount options.

thisisharrsh commented 2 months ago

The error message indicates that there's an issue with the mount options used (hard=,nfsvers=4.1,noresvport=,retrans=2,rsize=1048576,timeo=600,wsize=1048576). Make sure these options are correctly specified according to your NFS server's configuration and capabilities.

mr-elamin commented 5 days ago

I changed the NFS StorageClass of the "nfs-subdir-external-provisioner" to be the default storage class. then the PVC of the MongoDB bound successfully. otherwise it never bound. image