Minikube - 重启后文件消失

Minikube - files disappear after restart

我正在使用 minikube 版本 0.28.0,文件在 minikube 重启后不会保留。

我 运行 在注意到我的数据库数据在重新启动后消失后陷入了问题(即使 pods、pvpvc 说他们已经起来好几天了)。我使用 minikube ssh 创建了一些文件并注意到它们也消失了。

FWIW - 我 运行 minikube addons list 确认 default-storageclass 已启用

我应该使用 minikube --mount 将我的数据装载到我的开发机器的磁盘上吗?如何保存我的 pods' 数据?

这在 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 --vm-driver=none).

...

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

关于安装请阅读 Minikube 文档,Filesystem mounts

To mount a directory from the host into the guest using the mount subcommand:

minikube mount <source directory>:<target directory>

For example, this would mount your home directory to appear as /host within the minikube VM:

minikube mount $HOME:/host