Key Concepts
PVC
A request for storage that can be bound to a Persistent Volume (PV).
Storage Class
Defines the type of storage (SSD, HDD, network) and provisioner to use.
Access Modes
Defines how the volume can be accessed (single node, multiple nodes, read-only).
Capacity
The amount of storage requested and allocated.
Required Permissions
| Action | Permission |
|---|---|
| View PVCs | iam:project:infrastructure:kubernetes:read |
| Create PVC | iam:project:infrastructure:kubernetes:write |
| Edit PVC | iam:project:infrastructure:kubernetes:write |
| Delete PVC | iam:project:infrastructure:kubernetes:delete |
PVC Status Values
| Status | Description |
|---|---|
| Bound | PVC is successfully bound to a Persistent Volume |
| Pending | Waiting for a suitable PV to be provisioned or available |
| Lost | The PVC lost its binding to the underlying PV |
A PVC in “Pending” status typically means the storage provisioner is creating storage, or no matching PV exists. Check events for details.
Access Modes
| Mode | Abbreviation | Description |
|---|---|---|
| ReadWriteOnce | RWO | Volume can be mounted read-write by a single node |
| ReadOnlyMany | ROX | Volume can be mounted read-only by many nodes |
| ReadWriteMany | RWX | Volume can be mounted read-write by many nodes |
| ReadWriteOncePod | RWOP | Volume can be mounted read-write by a single pod |
How to View PVCs
How to View PVC Details
Review Details
View PVC information including:
- Overview: Name, namespace, status, storage class, age
- Storage: Requested size, actual capacity, volume name
- Access: Access modes, volume mode (Filesystem/Block)
- Selector: Label selector for PV matching (if specified)
- Conditions: PVC controller conditions
- Events: Recent provisioning and binding events
How to Create a PVC
Write YAML
Enter the PVC manifest in YAML format. Key fields:
spec.accessModes- How the volume can be accessedspec.resources.requests.storage- Amount of storage requestedspec.storageClassName- Storage class to use for provisioning
How to Edit a PVC
How to Delete a PVC
Volume Modes
PVCs support two volume modes:| Mode | Description |
|---|---|
| Filesystem | Volume is mounted as a directory (default) |
| Block | Volume is presented as a raw block device |
Example PVC
Basic PVC
PVC with Selector
Using PVCs in Pods
Storage Expansion
If the StorageClass allows volume expansion (allowVolumeExpansion: true), you can increase PVC size:
Volume expansion is supported by most cloud providers. Shrinking volumes is generally not supported.
Troubleshooting
PVC stuck in Pending status
PVC stuck in Pending status
- Check if a matching StorageClass exists
- Verify the StorageClass provisioner is running
- Check PVC events for provisioning errors
- Ensure sufficient cluster resources for storage
- Verify access mode is supported by the storage backend
PVC shows Lost status
PVC shows Lost status
- The underlying PV has been deleted or become unavailable
- Check PV status and events
- The storage backend may have failed
- Manual intervention may be required to recover data
Cannot delete PVC
Cannot delete PVC
- PVC may still be in use by pods
- Check for pods mounting the PVC:
kubectl get pods --all-namespaces -o json | grep <pvc-name> - Delete or update pods to remove the volume reference
- Check for finalizers blocking deletion
Volume expansion not working
Volume expansion not working
- Verify StorageClass has
allowVolumeExpansion: true - Check if the storage backend supports expansion
- Pod restart may be required for filesystem resize
- Check PVC conditions for resize status
Pod fails to mount PVC
Pod fails to mount PVC
- Verify PVC is in Bound status
- Check if access mode is compatible with pod’s node
- For RWO volumes, ensure no other node has it mounted
- Check kubelet logs on the node
- Verify the underlying storage is accessible
Wrong storage class used
Wrong storage class used
- If storageClassName is empty, the default class is used
- Explicitly set storageClassName in the PVC spec
- Check cluster’s default StorageClass:
kubectl get sc -o wide
FAQ
What is the difference between PVC and PV?
What is the difference between PVC and PV?
PV (Persistent Volume) is the actual storage resource in the cluster. PVC (Persistent Volume Claim) is a request for storage by a user. PVCs bind to PVs, abstracting storage details from users.
What happens to data when I delete a PVC?
What happens to data when I delete a PVC?
It depends on the PV’s reclaim policy:
- Delete: PV and data are deleted (default for dynamic provisioning)
- Retain: PV is kept for manual data recovery
- Recycle: Data is scrubbed (deprecated)
Can I use the same PVC in multiple pods?
Can I use the same PVC in multiple pods?
Yes, if the access mode allows it. ReadWriteMany (RWX) allows multiple pods on different nodes. ReadWriteOnce (RWO) allows multiple pods only on the same node.
How do I migrate data between PVCs?
How do I migrate data between PVCs?
Create a new PVC, run a data copy job between volumes, then update your workload to use the new PVC. Tools like
kubectl cp or custom jobs with both volumes mounted can help.What is dynamic provisioning?
What is dynamic provisioning?
When a PVC is created with a StorageClass, the provisioner automatically creates a matching PV. No manual PV creation is needed. Most cloud providers support dynamic provisioning.
Can I change the storage class of an existing PVC?
Can I change the storage class of an existing PVC?
No. StorageClass is immutable after PVC creation. Create a new PVC with the desired class and migrate your data.
What does 'WaitForFirstConsumer' mean?
What does 'WaitForFirstConsumer' mean?
A StorageClass with
volumeBindingMode: WaitForFirstConsumer delays PV provisioning until a pod using the PVC is scheduled. This ensures the PV is created in the correct availability zone.How do I back up PVC data?
How do I back up PVC data?
Use volume snapshots (if supported), application-level backups, or tools like Velero. The best approach depends on your storage backend and consistency requirements.