我在哪里可以找到主机文件系统上的 Kubernetes PV?

Where I can find Kubernetes PV on the host filesystem?

我想了解 Kubernetes 如何处理节点文件系统上的持久卷。

例如,如果我有一个 minikube 作为我的 Kubernetes 集群节点,并且我使用 PVC 创建多个 PV 可能 pods 如果我通过 ssh 连接到 minikube,我可以在 minikube 的文件系统上的哪里找到 PV?

如果我输入

lsblk

我明白了

sda 8:0 0 19.5G 0 disk

但未列出任何 PV 磁盘。

感谢您的回答。

因为它们是 hostPath,所以您不会在 lsblk 中看到它们。使用 "kubectl describe pv PV_NAME" 了解它们的位置。

您不会看到它,因为它作为 API 对象在 API 内部。

我建议阅读有关 Persistent Volumes 的 Kubernetes 文档。

A PersistentVolume (PV) is a piece of storage in the cluster that has been provisioned by an administrator. It is a resource in the cluster just like a node is a cluster resource. PVs are volume plugins like Volumes, but have a lifecycle independent of any individual pod that uses the PV. This API object captures the details of the implementation of the storage, be that NFS, iSCSI, or a cloud-provider-specific storage system.

A PersistentVolumeClaim (PVC) is a request for storage by a user. It is similar to a pod. Pods consume node resources and PVCs consume PV resources. Pods can request specific levels of resources (CPU and Memory). Claims can request specific size and access modes (e.g., can be mounted once read/write or many times read-only).

While PersistentVolumeClaims allow a user to consume abstract storage resources, it is common that users need PersistentVolumes with varying properties, such as performance, for different problems. Cluster administrators need to be able to offer a variety of PersistentVolumes that differ in more ways than just size and access modes, without exposing users to the details of how those volumes are implemented. For these needs there is the StorageClass resource.

Please see the detailed walkthrough with working examples.

您还可以查看 Kubernetes Volumes Guide,其中解释了存储类型、它们的持续时间以及如何在示例中使用它们。