Creating PersistentVolumeClaims
You'll learn: How to write PVC manifests that request storage with specific capacity, access modes, and storage classes.
What Is a PersistentVolumeClaim Manifest?
A PersistentVolumeClaim (PVC) is your application's formal request for storage. Think of it like ordering a storage unit: you specify how much space you need, how you'll access it (alone or shared), and optionally what "type" of storage you prefer. Writing a PVC manifest means creating a YAML file that describes these requirements.
Core PVC Manifest Structure
A PVC manifest contains these key specifications:
Capacity – The resources.requests.storage field defines how much storage you need (e.g., 5Gi).
Access Modes – Define how the volume can be accessed: ReadWriteOnce, ReadOnlyMany, or ReadWriteMany.
Storage Class (Optional) – The storageClassName field lets you request a specific storage type. Omitting it uses the default storage class, or matches any available PV if no default exists.
Basic PVC Example
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-storage-claim
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: standard
This PVC requests 10 gigabytes of storage with single-node read-write access, preferring the "standard" storage class. Kubernetes will search for a matching PersistentVolume (or dynamically provision one if the storage class supports it).
The Binding Promise
When you create a PVC, Kubernetes looks for a PV that satisfies all requirements: sufficient capacity, matching access modes, and compatible storage class. Once bound, your Pod can mount this claim like any volume.
Key Takeaway: PVC manifests are your storage reservation forms—specify capacity, access modes, and optionally a storage class to request the exact storage your application needs.