简体   繁体   中英

Kubernetes: minikube persistent volume local filesystem storage location

I've read through all the docs and a few SO posts and can't find an answer to this question:

Where does minikube persist its persistent volumes in my local mac filing system?

Thanks

First of all keep in mind that Kubernetes is running on Minikube cluster. Minikube itself run on Virtual Machine, so all data would be stored in this VM not on your MacOS.

When you want to point exact place where you would like to save this data in Kubernetes you could choose between:

A hostPath volume mounts a file or directory from the host node's filesystem into your Pod. This is not something that most Pods will need, but it offers a powerful escape hatch for some applications.

A local volume represents a mounted local storage device such as a disk, partition or directory.

Local volumes can only be used as a statically created PersistentVolume. Dynamic provisioning is not supported yet.

Compared to hostPath volumes, local volumes can be used in a durable and portable manner without manually scheduling Pods to nodes, as the system is aware of the volume's node constraints by looking at the node affinity on the PersistentVolume.

However, Minikube supports only hostpath .

In this case you should check Minikube documentation about Persistent Volumes

minikube supports PersistentVolumes of type hostPath out of the box. These PersistentVolumes are mapped to a directory inside the running minikube instance (usually a VM, unless you use --driver=none , --driver=docker , or --driver=podman ). For more information on how this works, read the Dynamic Provisioning section below.

minikube is configured to persist files stored under the following directories, which are made in the Minikube VM (or on your localhost if running on bare metal). You may lose data from other directories on reboots.

  • /data
  • /var/lib/minikube
  • /var/lib/docker
  • /tmp/hostpath_pv
  • /tmp/hostpath-provisioner

If you would like to mount directory from host you would need to use minikube mount .

$ minikube mount <source directory>:<target directory>

For more details, please check Minikube Mounting filesystems documentation.

If you are using the volume type hostPath the files are saved on your node.

To access your node filesystem you can use the command: minikube ssh and under your mounted path you'll find your documents.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM