PersistentVolumeClaim (PVC)¶
A PersistentVolumeClaim (PVC) represents a user's request for storage resources within a Kubernetes cluster^[400-devops__06-Kubernetes__k8s-ithelp__Day16__README.md]. It functions similarly to how a Pod requests node-level resources like CPU or memory, but specifically for [[PersistentVolume (PV)]] capacity^[400-devops__06-Kubernetes__k8s-ithelp__Day16__README.md]. The PVC consumes storage capacity from a PersistentVolume, abstracting the underlying storage implementation details from the user^[400-devops__06-Kubernetes__k8s-ithelp__Day16__README.md].
Concept and Functionality¶
The primary function of a PVC is to act as a storage claim that binds to a suitable PersistentVolume^[400-devops__06-Kubernetes__k8s-ithelp__Day16__README.md]. When a user creates a PVC, they specify specific requirements such as storage size and access modes (e.g., ReadWriteOnce, ReadOnlyMany, or ReadWriteMany)^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
The cluster control plane continuously monitors for PVCs and attempts to bind them to available PVs that match the claim's criteria^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]. If a matching PV is found, the two are bound, and the storage is provisioned for use^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]. If no matching PV is available, the PVC will remain in a Pending state indefinitely until a suitable volume is added^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
Lifecycle and Binding¶
A key characteristic of the PVC and PV relationship is the independence of their lifecycles relative to Pods^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]. Because the PV lifecycle is independent of the Pod, data can be retained even if the Pod consuming the PVC is destroyed or rescheduled^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]. This ensures data persistence across Pod restarts or failures.
Dynamic Provisioning¶
PVCs can utilize StorageClass resources to enable dynamic provisioning^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]. If a PVC specifies a storageClassName, the cluster can automatically create a new PersistentVolume (and the corresponding backend storage asset) to satisfy the request, rather than relying on pre-provisioned static volumes^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
Related Concepts¶
- [[PersistentVolume (PV)]]: The actual storage resource in the cluster that the PVC binds to.
- StorageClass: Defines the classes of storage (e.g., SSD, HDD) and is used for Dynamic Provisioning.
- Pod: Workloads that mount PVCs to access persistent storage.
- [[Access Modes]]: Specific capabilities like
ReadWriteOnceorReadWriteManythat define how a volume can be accessed.
Sources¶
- 400-devops__06-Kubernetes__k8s-ithelp__Day16__README.md
- 400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md