问题描述
Kubernetes/Openshift 中持久卷 (PV) 和持久卷声明 (PVC) 的区别是什么?参考文档?
What is the difference between persistent volume (PV) and persistent volume claim (PVC) in Kubernetes/ Openshift by referring to documentation?
简单来说两者有什么区别?
What is the difference between both in simple terms?
推荐答案
PVC 是对存储需求的声明,它可以在某个时候变得可用/满足 - 就像绑定到某些实际的PV.
PVC is a declaration of need for storage that can at some point become available / satisfied - as in bound to some actual PV.
这有点像 promise.PVC 承诺它会在某个时候转换"为您的应用程序能够使用的存储卷,以及定义的特性之一,如类、大小和访问模式(ROX、RWO 和 RWX).
It is a bit like the asynchronous programming concept of a promise. PVC promises that it will at some point "translate" into storage volume that your application will be able to use, and one of defined characteristics like class, size, and access mode (ROX, RWO, and RWX).
这是一种将特定存储实现从您的 Pod/部署中抽象出来的方法.在大多数情况下,您的应用程序不需要声明从大小为 Y 的服务器 X 给我 NFS 存储";它更像是我需要默认类和大小 Y 的持久存储".
This is a way to abstract thinking about a particular storage implementation away from your pods/deployments. Your application in most cases does not need to declare "give me NFS storage from server X of size Y"; it is more like "I need persistent storage of default class and size Y".
这样,不同集群上的部署可以选择不同的方式来满足这种需求.一个可以链接 EBS 设备,另一个可以配置 GlusterFS,并且您的核心清单在这两种情况下仍然相同.
With this, deployments on different clusters can choose to differently satisfy that need. One can link an EBS device, another can provision a GlusterFS, and your core manifests are still the same in both cases.
此外,您可以在部署中定义卷声明模板,以便每个 pod 获得自动创建的反射 PVC(即,支持一组可扩展 pod 的基础架构无关存储定义,其中每个都需要自己的专用存储).
Furthermore, you can have Volume Claim Templates defined in your deployment, so that each pod gets a reflecting PVC created automatically (i.e., supporting infrastructure-agnostic storage definition for a group of scalable pods where each needs its own dedicated storage).
这篇关于简单来说,持久卷 (PV) 和持久卷声明 (PVC) 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!