1

I need to set up an NFS server for my k8s cluster. I can set it up and mount it to a client running on bare-metal ubuntu but when I try to mount the NFS to a container (the client is an ubuntu 18.04 container) it fails with this error:

$ mount 10.203.20.160:/var/nfs/general /nfs/general
mount: /nfs/general: cannot mount 10.203.20.160:/var/nfs/general read-only.

$ mount 10.203.20.160:/var/nfs/general /nfs/general --rw
mount: /nfs/general: 10.203.20.160:/var/nfs/general is write-protected but explicit read-write mode requested.

$ mount 10.203.20.160:/var/nfs/general /nfs/general --ro
mount: /nfs/general: cannot mount 10.203.20.160:/var/nfs/general read-only.

I am sure that the server configurations are correct because as I said I am able to mount if I am on a bare-metal machine but I don't know why it fails when I am inside a container.

My server configs:

  • NFS directory access rights:
$ ls -la /var/nfs/general
total 8
drwxr-xr-x 2 777 nogroup 4096 Oct 21 10:00 .
drwxr-xr-x 3 777 root    4096 Oct 21 10:00 ..
  • /etc/exports:
$ cat /etc/exports
/var/nfs/general *(rw,sync,no_subtree_check,no_root_squash)
AVarf
  • 449
  • 1
  • 6
  • 18

1 Answers1

1

Follow the offial guide, explain well how to connect NFS to container in kubernetes: https://docs.docker.com/ee/ucp/kubernetes/storage/use-nfs-volumes/

fox91
  • 163
  • 7