I am running minikube v0.24.1. In this minikube, I will create a Pod for my nginx application. And also I want to pass data from my local directory.
That means I wan
Minikube already mounts by default home directory to VM:
/Users
homedir.HomeDir()
You can see how it does this, if you browse through Minikube sources.
Here is the search for the moment, but result might change over time:
https://github.com/kubernetes/minikube/search?q=DefaultMountDir&unscoped_q=DefaultMountDir
The definition of the HomeDir()
is:
https://godoc.org/k8s.io/client-go/util/homedir
You can always do minikube ssh
into the Minikube VM and explore it:
$ df -hl
Filesystem Size Used Avail Use% Mounted on
...
/Users 466G 442G 25G 95% /Users
As Minikube is a single node Kubernetes cluster, you can then mount /Users/...
inside your pods.
minikube mount /path/to/dir/to/mount:/vm-mount-path
is the recommended way to mount directories into minikube so that they can be used in your local Kubernetes cluster. The command works on all supported platforms.
See documentation and example: https://minikube.sigs.k8s.io/docs/tasks/mount/
Not sure if I joined the party late but I did a root:root mapping by doing following command:
minikube start --mount-string="/:/"
This just will just mount your local file system root to minikube and keeps things seamless between the systems.Hope it helps.