'cannot mount NFS share on my Mac PC to minikube cluster

Problem

To make k8s multinodes dev env, I was trying to use NFS persistent volume in minikube with multi-nodes and cannot run pods properly. It seems there's something wrong with NFS setting. So I run minikube ssh and tried to mount the nfs volume manually first by mount command but it doesnt work, which bring me here.

When I run

sudo mount -t nfs 192.168.xx.xx(=macpc's IP):/PATH/TO/EXPORTED/DIR/ON/MACPC /PATH/TO/MOUNT/POINT/IN/MINIKUBE/NODE

in minikube master node, the output is

mount.nfs: requested NFS version or transport protocol is not supported

Some relavant info is

NFS client: minikube nodes

NFS server: my Mac PC

minikube driver: docker

Cluster comprises 3 nodes. (1 master and 2 worker nodes)

Currently there's no k8s resources (such as deployment, pv and pvc) in cluster.

minikube nodes' os is Ubuntu so I guess "nfs-utils" is not relavant and not installed. "nfs-common" is preinstalled in minikube.

Please see the following sections for more detail.

Goal

The goal is mount cmd in minikube nodes succeeds and nfs share on my Mac pc mounts properly.

What I've done so far is

On NFS server side,

created /etc/exports file on mac pc. The content is like

/PATH/TO/EXPORTED/DIR/ON/MACPC -mapall=user:group 192.168.xx.xx(=the output of "minikube ip")

and run nfsd update and then showmount -e cmd outputs

Exports list on localhost:
/PATH/TO/EXPORTED/DIR/ON/MACPC 192.168.xx.xx(=the output of "minikube ip")

rpcinfo -p shows rpcbind(=portmapper in linux), status, nlockmgr, rquotad, nfs, mountd are all up in tcp and udp

ping 192.168.xx.xx(=the output of "minikube ip") says

Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
and continues

It seems I can't reach minikube from host.

On NFS client side,

started nfs-common and rpcbind services with systemctl cmd in all minikube nodes. By running sudo systemctl status rpcbind and sudo systemctl status nfs-common, I confirmed rpcbind and nfs-common are running.

minikube ssh output

Last login: Mon Mar 28 09:18:38 2022 from 192.168.xx.xx(=I guess my macpc's IP seen from minikube cluster)

so I run

sudo mount -t nfs 192.168.xx.xx(=macpc's IP):/PATH/TO/EXPORTED/DIR/ON/MACPC /PATH/TO/MOUNT/POINT/IN/MINIKUBE/NODE

in minikube master node. The output is

mount.nfs: requested NFS version or transport protocol is not supported

rpcinfo -p shows only portmapper and status are running. I am not sure this is ok.

ping 192.168.xx.xx(=macpc's IP) works properly.

ping host.minikube.internal works properly.

nc -vz 192.168.xx.xx(=macpc's IP) 2049 outputs connection refused

nc -vz host.minikube.internal 2049 outputs succeeded!

Thanks in advance!



Solution 1:[1]

I decided to use another type of volume instead.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Steve