Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't mount NFS share as PV into kubernetes #2515

Closed
andjelx opened this issue Jan 26, 2018 · 9 comments
Closed

Can't mount NFS share as PV into kubernetes #2515

andjelx opened this issue Jan 26, 2018 · 9 comments

Comments

@andjelx
Copy link

andjelx commented Jan 26, 2018

Expected behavior

Have following definition to mount NFS share into kubernetes as PV.

kind: PersistentVolume
metadata:
 name: git-sync-tools
 labels:
   type: nfs
   name: git-sync-tools
spec:
 capacity:
   storage: 10Gi
 accessModes:
   - ReadWriteMany
 persistentVolumeReclaimPolicy: Recycle
 mountOptions:
    - resvport
 nfs:
   path: /media/nfsshare
   server: 172.16.167.131

Actual behavior

Getting following error in kubectl describe po/podname

Warning  FailedMount            <invalid> (x12 over 8m)  kubelet, docker-for-desktop  MountVolume.SetUp failed for volume "git-sync-tools" : mount failed: exit status 32
Mounting command: mount
Mounting arguments: -t nfs 172.16.167.131:/media/nfsshare /var/lib/kubelet/pods/b65c8708-01cd-11e8-8032-025000000001/volumes/kubernetes.io~nfs/git-sync-tools
Output: mount: wrong fs type, bad option, bad superblock on 172.16.167.131:/media/nfsshare,
       missing codepage or helper program, or other error
       (for several filesystems (e.g. nfs, cifs) you might
       need a /sbin/mount.<type> helper program)

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

Information

Docker for Mac: version: 18.01.0-ce-mac48 (d1778b704353fa5b79142a2055a2c11c8b48a653)
macOS: version 10.13.3 (build: 17D47)
Diagnostic ID: 2F4022FA-E678-4671-956D-369B65995F2D/20180126-110454

Steps to reproduce the behavior

  1. kubectl apply -f pv.yaml (see above)
@rcoup
Copy link

rcoup commented Jan 26, 2018

Looks like the nfs module is in the kernel

/ # cat /proc/modules
nfs 163840 0 - Live 0x0000000000000000
...

but /sbin/mount.nfs isn't part of the linuxkit kubelet container? Maybe need an apk add nfs-utils in https://github.com/linuxkit/kubernetes/blob/master/pkg/kubelet/Dockerfile ?

@pgayvallet
Copy link

nfs-utils has been added in latest 18.02-RC on edge. Could you try and confirm this fixes it ?

@rcoup
Copy link

rcoup commented Feb 5, 2018

@pgayvallet closer 😄

  Warning  FailedMount            <invalid> (x4 over 10s)  kubelet, docker-for-desktop  MountVolume.SetUp failed for volume "storage" : mount failed: exit status 32
Mounting command: mount
Mounting arguments: -t nfs -o ro mynfshost:/remote/storage /var/lib/kubelet/pods/d8407421-0a86-11e8-a883-025000000001/volumes/kubernetes.io~nfs/storage
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.

Snipped pod spec looks like:

apiVersion: v1
kind: Pod
metadata:
  name: bumptious-gnat-77b9dd4d59-dwqz4
spec:
  containers:
  - image: myapp:latest
    volumeMounts:
    - mountPath: /local/storage
      name: storage
      readOnly: true
  volumes:
  - name: storage
    nfs:
      path: /remote/storage
      readOnly: true
      server: mynfshost

@pgayvallet
Copy link

Hum, should be running...

@rcoup By any chance, could you perform a factory reset (or clear all data) and try again, or is this out of the question ? I think it may be caused by the state of the vm.

@rcoup
Copy link

rcoup commented Feb 6, 2018

@pgayvallet same thing. From a quick Google looks like maybe both rpcbind+statd need starting?

@pgayvallet
Copy link

My bad, the commit starting these services was not on the PR merged for this issue.

Will be merged on next Edge version.

Workaround for now if that's blocking
from inside the vm

screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty

enter the kubelet container

ctr -n services.linuxkit tasks exec --tty --exec-id ssh-$(hostname)-$$ kubelet ash -l

then manually start the services :

rpcbind
rpc.statd

You'll need to do with after each vm restart though.

@rcoup
Copy link

rcoup commented Feb 13, 2018

Thanks! ❤️

@guillaumerose
Copy link
Contributor

It's in the current release. Give it a try!

@docker-robott
Copy link
Collaborator

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle locked

@docker docker locked and limited conversation to collaborators Jun 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants