nfs-subdir-external-provisioner icon indicating copy to clipboard operation
nfs-subdir-external-provisioner copied to clipboard

NFS mount within K8s pods failing

Open samuel-sujith opened this issue 3 years ago • 1 comments

I am trying to get NFS share mounted into a k8s pod but its failing with the below error

mount.nfs: rpc.statd is not running but is required for remote locking. mount.nfs: Either use '-o nolock' to keep locks local, or start statd.

My deployment yaml is as below

kind: Deployment
apiVersion: apps/v1
metadata:
  name: nfs-client-provisioner
spec:
  selector:
    matchLabels:
      app: nfs-client-provisioner
  replicas: 1
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: nfs-client-provisioner
    spec:
      serviceAccountName: nfs-client-provisioner
      containers:
        - name: nfs-client-provisioner
          image: gcr.io/k8s-staging-sig-storage/nfs-subdir-external-provisioner:v4.0.0
          securityContext:
            allowPrivilegeEscalation: true
            privileged: true
          volumeMounts:
            - name: nfs-client-root
              mountPath: /persistentvolumes
          env:
            - name: PROVISIONER_NAME
              value: nfs-provisioner
            - name: NFS_SERVER
              value: NFS SERVER PATH
            - name: NFS_PATH
              value: /filesharepath
      volumes:
        - name: nfs-client-root
          nfs:
            server: <NFS IP>
            path: /filesharepath

I get this error message in the k8s pods for the provisioner

MountVolume.SetUp failed for volume "nfs-client-root" : mount failed: exit status 32 Mounting command: mount Mounting arguments: -t nfs <serverIP>: /var/lib/kubelet/pods/87e9eee3-b912-4e94-8fd8-060fcb7570d4/volumes/kubernetes.io~nfs/nfs-client-root Output: mount.nfs: rpc.statd is not running but is required for remote locking. mount.nfs: Either use '-o nolock' to keep locks local, or start statd.

I tried mounting the NFS folder directly into my VM and it works fine. Only the k8s pods are not unable to mount.

Please assist.

samuel-sujith avatar Aug 25 '22 13:08 samuel-sujith

You need to install the nfs client on your k8s nodes. On ubuntu/debian that is done by apt install nfs-common

blieb avatar Sep 02 '22 20:09 blieb

You need to install the nfs client on your k8s nodes. On ubuntu/debian that is done by apt install nfs-common

thanks, I have solved this problem. but why need node install nfs-common ?

bigbirdxixi avatar Oct 26 '22 03:10 bigbirdxixi

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jan 24 '23 04:01 k8s-triage-robot

You need to install the nfs client on your k8s nodes. On ubuntu/debian that is done by apt install nfs-common

thanks, I have solved this problem. but why need node install nfs-common ?

Kubelet needs to mount the nfs in to the container. In order to do that he must have nfs client installed. The nfs-common package contain the tool mount.nfs that used as a client to mount nfs directories.

I am closing the issue as it is solved.

/close

yonatankahana avatar Feb 17 '23 23:02 yonatankahana

@yonatankahana: Closing this issue.

In response to this:

You need to install the nfs client on your k8s nodes. On ubuntu/debian that is done by apt install nfs-common

thanks, I have solved this problem. but why need node install nfs-common ?

Kubelet needs to mount the nfs in to the container. In order to do that he must have nfs client installed. The nfs-common package contain the tool mount.nfs that used as a client to mount nfs directories.

I am closing the issue as it is solved.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Feb 17 '23 23:02 k8s-ci-robot