How to mount a Host folder in minikube VM
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
When you run Minikube in a VM-based or container-based local cluster, the Kubernetes node does not automatically see your host filesystem. The usual solution is to mount a host directory into Minikube and then expose that mounted path to pods with a hostPath volume.
Use minikube mount
The most direct command is:
This tells Minikube to make the host directory available inside the Minikube node at /mnt/data.
A few practical points matter immediately:
- the command usually stays running while the mount is active
- the host path must exist before mounting
- after a Minikube restart, you typically need to start the mount again
So this is convenient for local development, but it is not a persistent cluster storage strategy.
Verify the Mount Inside Minikube
After starting the mount, check the node directly:
If the files are visible here, Minikube sees the host folder correctly. That is the right place to debug first before involving Kubernetes manifests.
Expose the Mounted Path to a Pod
Once the directory exists inside the Minikube node, a pod can consume it through a hostPath volume:
Apply it with:
Now the pod sees the data through /data, but the actual files still originate from your host machine through the Minikube mount.
Driver and Development Workflow Notes
The exact mount behavior depends on the Minikube driver. With VM drivers, you are literally mounting into the VM. With some container-based setups, the path mapping behavior can feel different because the node itself is containerized.
That is why the two-step mental model helps:
- host path into Minikube node
- Minikube node path into pod
If step one fails, Kubernetes manifests will not rescue it.
It is also worth remembering that mount performance can differ from native filesystem access. Large live-reload workflows, databases, or file-heavy build caches may feel slower through a host mount than through ordinary local disk inside the node.
For quick experiments that need live host files, the tradeoff is usually worth it. For heavier local state, a normal persistent volume workflow inside Minikube can be more predictable and faster overall. Measure both approaches.
Common Pitfalls
One common mistake is trying to mount the host path directly into the pod manifest. The pod only sees node paths, so the host directory must first be visible inside Minikube.
Another issue is forgetting that minikube mount is often an active foreground process. If you stop the terminal or restart Minikube, the mount may disappear.
It is also easy to use this setup as if it were production-grade storage. hostPath plus minikube mount is mainly a local development convenience, not a portable persistent-volume strategy.
Summary
- Use
minikube mount host_path:node_pathto expose a host folder inside the Minikube node. - Verify the node-side path with
minikube sshbefore debugging pod manifests. - Use a
hostPathvolume to make the mounted node directory visible inside pods. - Remember that the mount usually needs to be restarted after Minikube restarts.
- Treat this approach as a local development workflow, not a production storage design.
Related reading
- How to mount a postgresql volume using Aws EBS in Kubernete
- How to mount /dev/kvm in a non-privileged pod?
- How to mount multiple files / secrets into common directory in kubernetes?
- How to mount PostgreSQL data directory in Kubernetes?
- How to move a pod from one node to another in kubernetes
- How to override a multi-line string with --set in helm install command?
- How to override Dockerfile's entrypoint /bin/sh from kubernetes job's deployment yml?
- How to override the Release.namespace for subcharts?

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.