Minikube 卷
Minikube volumes
Minikube 应该使本地 运行 Kubernetes 变得简单,不仅对 "getting started" 而且 "day-to-day development workflows"。
来源:https://github.com/kubernetes/minikube/blob/master/ROADMAP.md#goals
但我也可以读到:"PersistentVolumes are mapped to a directory inside the minikube VM. The Minikube VM boots into a tmpfs, so most directories will not be persisted across reboots (minikube stop)"
来源:https://kubernetes.io/docs/getting-started-guides/minikube/#persistent-volumes
如果我的开发需要持久存储(MySQL 数据库,mongodb 数据库,...)怎么办?我需要扔掉我的 Minikube 并直接安装完整的 Kubernetes 吗?
the documentation 中对此进行了介绍。相关部分在您已经引用的句子之后开始:
However, Minikube is configured to persist files stored under the following host directories:
- /data
- /var/lib/localkube
- /var/lib/docker
Here is an example PersistentVolume config to persist data in the ‘/data’ directory:
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv0001
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 5Gi
hostPath:
path: /data/pv0001/
只需声明映射到主机 /data
中任何目录的 hostPath
卷,这些卷应该在重新启动后保持不变。
这是 Minikube 贡献者的回答,确认文档中存在问题:
I've reworded the readme to make a little more sense.
The host is the computer you're running minikube on. This is only
exposed to the VM through the mounted host folders
https://github.com/kubernetes/minikube/blob/master/docs/host_folder_mount.md
The guest, or minikube VM, will persist certain folders to a disk
stored on the host (something like
~/.minikube/machines/minikube/disk.vmdk). Files stored in certain
directories in the minikube VM will persist between start/stops, but
not deletes.
或者您可以尝试 https://github.com/reachlin/k8s0/,这是一个使用 ansible 安装在单个主机上的成熟的 kubernetes。
Minikube 应该使本地 运行 Kubernetes 变得简单,不仅对 "getting started" 而且 "day-to-day development workflows"。
来源:https://github.com/kubernetes/minikube/blob/master/ROADMAP.md#goals
但我也可以读到:"PersistentVolumes are mapped to a directory inside the minikube VM. The Minikube VM boots into a tmpfs, so most directories will not be persisted across reboots (minikube stop)"
来源:https://kubernetes.io/docs/getting-started-guides/minikube/#persistent-volumes
如果我的开发需要持久存储(MySQL 数据库,mongodb 数据库,...)怎么办?我需要扔掉我的 Minikube 并直接安装完整的 Kubernetes 吗?
the documentation 中对此进行了介绍。相关部分在您已经引用的句子之后开始:
However, Minikube is configured to persist files stored under the following host directories:
- /data
- /var/lib/localkube
- /var/lib/docker
Here is an example PersistentVolume config to persist data in the ‘/data’ directory:
apiVersion: v1 kind: PersistentVolume metadata: name: pv0001 spec: accessModes: - ReadWriteOnce capacity: storage: 5Gi hostPath: path: /data/pv0001/
只需声明映射到主机 /data
中任何目录的 hostPath
卷,这些卷应该在重新启动后保持不变。
这是 Minikube 贡献者的回答,确认文档中存在问题:
I've reworded the readme to make a little more sense.
The host is the computer you're running minikube on. This is only exposed to the VM through the mounted host folders https://github.com/kubernetes/minikube/blob/master/docs/host_folder_mount.md
The guest, or minikube VM, will persist certain folders to a disk stored on the host (something like ~/.minikube/machines/minikube/disk.vmdk). Files stored in certain directories in the minikube VM will persist between start/stops, but not deletes.
或者您可以尝试 https://github.com/reachlin/k8s0/,这是一个使用 ansible 安装在单个主机上的成熟的 kubernetes。