gpt4 book ai didi

kubernetes - Kubernetes:minikube持久卷本地文件系统存储位置

转载 作者:行者123 更新时间:2023-12-02 11:42:10 25 4
gpt4 key购买 nike

我已经阅读了所有文档和一些SO帖子,但找不到以下问题的答案:
minikube在我的本地mac文件系统中将持久卷保留在哪里?
谢谢

最佳答案

首先请记住,Kubernetes在Minikube集群上运行。 Minikube本身在虚拟机上运行,​​因此所有数据都将存储在此VM中,而不是在MacOS上。
当您想指出要将数据保存在Kubernetes中的确切位置时,可以选择以下选项:

  • hostpath

  • 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.


  • local

  • 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.


    但是, Minikube 仅支持 hostpath
    在这种情况下,您应该检查有关 Persistent VolumesMinikube documentation

    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 followingdirectories, which are made in the Minikube VM (or on your localhostif running on bare metal). You may lose data from other directories onreboots.

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

    如果要从主机挂载目录,则需要使用 minikube mount
    $ minikube mount <source directory>:<target directory>
    有关更多详细信息,请检查 Minikube Mounting filesystems文档。

    关于kubernetes - Kubernetes:minikube持久卷本地文件系统存储位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63559779/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com