Minikube multi-node cluster mounting host machine filesystem to all the nodes

805 views Asked by At

I am creating a Minikube multi-node kubernetes cluster with 2 nodes mounting the $HOME/Minikube/mount directory from the host filesystem to the data directory in the cluster nodes.

I used the following command to achieve this,

minikube start --nodes 2 --cpus 2 --memory 2048 --disk-size 10g --mount-string $HOME/Minikube/mount:/data --mount --namespace test -p multi-node

Minikube version: 1.28.0
Kubernetes client version: v1.26.0
Kubernetes server version: v1.24.3

Expectation was to find the /data directory in both nodes (multi-node(control-plane) and multi-node-m02) mount to the $HOME/Minikube/mount directory of the host filesystem.

But when i ssh to the Minikube nodes i only see the /data directory mount in the multi-node which functions as the kubernetes control plane node. Local filesystem directory is not mount to both nodes.

minikube ssh -n multi-node
ls -la /data/

$ ls -la /data/
total 0

minikube ssh -n multi-node-m02
ls -la /data/

$ ls -la /data ls: cannot access '/data': No such file or directory

Is there some way to achieve this requirement of mounting a local filesystem directory to all the nodes in a multi-node Minikube k8s cluster?

1

There are 1 answers

2
Sai Chandra Gadde On BEST ANSWER

As they mentioned in this issue, using minikube start --mount has some issues when mounting the files. Try using the minikube mount string.

If the issue still persists the issue is with the storage provisioner broken for multinode mode. For this issue minikube has recently added a local path provisioner, adding it to the default storage class resolves your issue.