kubernetes 工作空间中的持久卷和声明
Persistent volume and claims in kubernetes workspace
我已经在 k8 的工作空间中工作了大约 6 个月,并且一直想知道为什么我们需要 Persistent Volume(PV) 和 Persistent Volume claim(PVC)?谁能给我讲清楚这个概念?
PV 和 PVC 的分离实现了 Kubernetes 集群管理和资源管理的职责划分。
PV 是集群管理员创建的对象,它们抽象出底层存储资源以向用户公开统一视图(即,这是您可以使用的 "volume"很多 space)。他们只关心将存储资源暴露给集群,而不关心将由谁或如何使用它。引用文档:
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.
另一方面,集群用户(即部署和维护应用程序的用户)可以使用 PVC 动态请求和释放存储块,而无需担心底层基础设施。他们不一定要关心存储的来源或实际管理。引用文档
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).
在动态配置的部署中,Kubernetes 承担 PV 管理的角色。用户只需请求 PVC,Kubernetes 将提供 PV 并将 PVC 绑定到 PV,从而使存储配置过程对集群用户透明。
希望对您有所帮助!
这些信息来自Kubernetes In Action本书。
Decoupling pods from the underlying storage technology
理想情况下,开发人员在 Kubernetes 上部署他们的应用程序永远不必知道下面使用了哪种存储技术,就像他们不必知道正在使用哪种类型的物理服务器一样 运行 他们 pods.
当开发人员的应用程序需要一定量的持久存储时,他们可以从 Kubernetes 请求它,就像他们在创建 pod 时可以请求 CPU、内存和其他资源一样。系统管理员可以配置集群,以便它可以为应用程序提供他们请求的内容。
Introducing PersistentVolumes and PersistentVolumeClaims
为了使应用能够在 Kubernetes 集群中请求存储而无需处理基础架构细节,引入了两个新资源。它们是 PersistentVolumes 和 PersistentVolumeClaims。
不是开发人员向他们的 pod 添加特定技术的卷,而是集群管理员设置底层存储,然后通过创建 PersistentVolume 资源在 Kubernetes 中注册它通过 Kubernetes API 服务器。创建 PersistentVolume 时,管理员指定其大小及其支持的访问模式。
This image is from Kubernetes In Action book, too.
当集群用户需要在他们的 pods 之一中使用持久存储时,他们首先创建一个 PersistentVolumeClaim 清单,指定最小大小和访问模式要求。然后用户将 PersistentVolumeClaim 清单提交给 Kubernetes API 服务器,Kubernetes 找到合适的 PersistentVolume 并将该卷绑定到声明。
然后 PersistentVolumeClaim 可以用作 pod.Other 用户不能使用相同的 PersistentVolume 中的卷之一直到通过删除绑定 PersistentVolumeClaim.
释放它
我已经在 k8 的工作空间中工作了大约 6 个月,并且一直想知道为什么我们需要 Persistent Volume(PV) 和 Persistent Volume claim(PVC)?谁能给我讲清楚这个概念?
PV 和 PVC 的分离实现了 Kubernetes 集群管理和资源管理的职责划分。
PV 是集群管理员创建的对象,它们抽象出底层存储资源以向用户公开统一视图(即,这是您可以使用的 "volume"很多 space)。他们只关心将存储资源暴露给集群,而不关心将由谁或如何使用它。引用文档:
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.
另一方面,集群用户(即部署和维护应用程序的用户)可以使用 PVC 动态请求和释放存储块,而无需担心底层基础设施。他们不一定要关心存储的来源或实际管理。引用文档
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).
在动态配置的部署中,Kubernetes 承担 PV 管理的角色。用户只需请求 PVC,Kubernetes 将提供 PV 并将 PVC 绑定到 PV,从而使存储配置过程对集群用户透明。
希望对您有所帮助!
这些信息来自Kubernetes In Action本书。
Decoupling pods from the underlying storage technology
理想情况下,开发人员在 Kubernetes 上部署他们的应用程序永远不必知道下面使用了哪种存储技术,就像他们不必知道正在使用哪种类型的物理服务器一样 运行 他们 pods.
当开发人员的应用程序需要一定量的持久存储时,他们可以从 Kubernetes 请求它,就像他们在创建 pod 时可以请求 CPU、内存和其他资源一样。系统管理员可以配置集群,以便它可以为应用程序提供他们请求的内容。
Introducing PersistentVolumes and PersistentVolumeClaims
为了使应用能够在 Kubernetes 集群中请求存储而无需处理基础架构细节,引入了两个新资源。它们是 PersistentVolumes 和 PersistentVolumeClaims。
不是开发人员向他们的 pod 添加特定技术的卷,而是集群管理员设置底层存储,然后通过创建 PersistentVolume 资源在 Kubernetes 中注册它通过 Kubernetes API 服务器。创建 PersistentVolume 时,管理员指定其大小及其支持的访问模式。
This image is from Kubernetes In Action book, too.
当集群用户需要在他们的 pods 之一中使用持久存储时,他们首先创建一个 PersistentVolumeClaim 清单,指定最小大小和访问模式要求。然后用户将 PersistentVolumeClaim 清单提交给 Kubernetes API 服务器,Kubernetes 找到合适的 PersistentVolume 并将该卷绑定到声明。
然后 PersistentVolumeClaim 可以用作 pod.Other 用户不能使用相同的 PersistentVolume 中的卷之一直到通过删除绑定 PersistentVolumeClaim.
释放它