Kubernetes Storage: PVs, PVCs, and StorageClasses
Implement Kubernetes storage with PVs, PVCs, and StorageClasses. Learn how CSI drivers affect topology, access modes, snapshots, backups, and recovery.
In Kubernetes v1.37.1, PersistentVolumes (PVs), PersistentVolumeClaims (PVCs), and StorageClasses connect workloads to storage. The CSI driver and storage backend determine which access modes, topologies, snapshots, and attachment behaviors actually work. StatefulSets can create a PVC per replica, but neither a StatefulSet nor a volume snapshot replaces a tested, application-consistent backup and restore plan.
Kubernetes Storage: PersistentVolumes, Claims, and StorageClasses
Examples in this guide target Kubernetes v1.37.1 and use stable API groups such as v1, storage.k8s.io/v1, and snapshot.storage.k8s.io/v1. Examples using cloud storage assume a compatible CSI driver is installed. The driver and its backend determine the actual provisioning, attachment, mount, expansion, topology, and snapshot behavior.
Introduction
PersistentVolumes (PVs), PersistentVolumeClaims (PVCs), and StorageClasses separate a workload’s storage request from the backing volume. PVs are cluster-scoped, PVCs are namespace-scoped, and StorageClasses describe dynamic provisioning.
The examples compare static and dynamic provisioning and explain which behaviors depend on the storage driver.
If you are new to Kubernetes, start with the Kubernetes fundamentals post. For StatefulSet configuration, see the Kubernetes Workload Resources post.
PV and PVC lifecycle
The PV lifecycle follows these phases:
- Provisioning: PV is created statically or dynamically
- Binding: PVC binds to a PV that satisfies its requirements
- Using: Pod uses the mounted volume
- Releasing: the Pod stops using the volume; the PVC remains until it is deleted
- Reclaiming: after the claim is released, the PV reclaim policy controls what happens to the PV and backing storage
Volume configuration examples
Before diving into the manifests, understand how the three objects connect. A PersistentVolume defines the actual storage resource. A PersistentVolumeClaim requests a slice of that storage with specific size and access requirements. A Pod mounts the PVC to consume the storage in a container. The examples below show each piece in isolation, followed by how they chain together in a Pod spec.
PersistentVolume example
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-fast-storage
spec:
capacity:
storage: 100Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: fast-ssd
csi:
driver: ebs.csi.aws.com
volumeHandle: vol-0abc123def456
fsType: ext4
PersistentVolumeClaim example
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: database-storage
namespace: production
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Gi
storageClassName: fast-ssd
Using a PVC in a Pod
apiVersion: v1
kind: Pod
metadata:
name: database
namespace: production
spec:
containers:
- name: postgres
image: postgres:15
volumeMounts:
- name: data
mountPath: /var/lib/postgresql/data
volumes:
- name: data
persistentVolumeClaim:
claimName: database-storage
The PVC must exist in the same namespace as the pod. The PV does not need to be in the same namespace (PVs are cluster-wide).
Access modes and usage patterns
Access modes
| Mode | Abbreviation | Meaning for PV/PVC matching and placement |
|---|---|---|
| ReadWriteOnce | RWO | Read-write mount on one node; multiple Pods on that same node may use it |
| ReadOnlyMany | ROX | Requests read-only mounts on multiple nodes when the driver and backend support them |
| ReadWriteMany | RWX | Read-write mounts from multiple nodes, when the driver and backend support it |
| ReadWriteOncePod | RWOP | Read-write use by one Pod cluster-wide, with a compatible CSI driver and sidecars |
Access modes help match PVs to PVCs and can constrain where a volume may be mounted. They do not provide application-level write protection or filesystem locking. RWOP requests single-Pod use when supported, but it does not coordinate application writes. RWO is a one-node mode, not a one-Pod mode; several Pods on the selected node may use the volume. A read-only mount, backend access controls, and application coordination are separate concerns. An access-mode label alone does not make concurrent writes safe.
For RWOP, check the Kubernetes and CSI sidecar version requirements in the driver documentation. RWX works only if both the CSI driver and storage backend support multi-node read-write access. A CSI driver can also impose attachment limits or topology constraints beyond the access-mode match.
When to use each access mode
| Access mode | Common fit | Check before relying on it |
|---|---|---|
| ReadWriteOnce | A volume used from one node | Multiple Pods on that node can still access it; confirm app-level safety |
| ReadWriteOncePod | A volume that must be mounted by one Pod | CSI driver and required sidecars must support RWOP |
| ReadOnlyMany | Read-only data mounted on multiple nodes | Confirm the driver/backend supports it and use read-only mounts as needed |
| ReadWriteMany | Shared filesystem use across multiple nodes | Confirm backend semantics, locking, and app behavior; RWX alone is not enough |
PV lifecycle flow
flowchart LR
A[Provision] --> B[Bind: PVC matches PV]
B --> C[Pod uses volume]
C --> D[Release: PVC deleted]
D --> E{Reclaim Policy}
E -->|Retain| F[Manual cleanup<br/>or restore]
E -->|Delete| G[Volume deleted]
Static vs dynamic provisioning
Static provisioning means you create PVs manually before any PVC requests come in. You know the exact storage you have and you allocate it to workloads manually.
Dynamic provisioning creates PVs automatically when a PVC requests them. Kubernetes uses a StorageClass to determine what kind of storage to provision.
Static provisioning
Use static provisioning when you already know your storage footprint or when the storage lives outside Kubernetes. On-premises SAN LUNs, pre-allocated NFS exports, and local disks fall into this category. You create each PersistentVolume manually, and users request storage by creating a PVC that matches one of your pre-made PVs.
The main advantage is predictability. You choose the node, zone, and capacity for each volume. This can help when storage needs prior approval or a workload must use a particular disk. You also track capacity yourself. Ten 100Gi PVs represent 1TiB of allocated capacity, whether workloads use it or not.
# Admin creates the PV
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-manual-001
spec:
capacity:
storage: 200Gi
accessModes:
- ReadWriteOnce
storageClassName: manual
hostPath:
path: /data/pv-manual-001
# User creates PVC
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-app-storage
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Gi
storageClassName: manual
Static provisioning gives administrators precise control. It also requires manual tracking of available storage capacity.
Dynamic provisioning
Dynamic provisioning removes the need to create each PV manually. The storage team still configures and monitors the StorageClass, driver, backend quota, and supported parameters.
Dynamic provisioning is common for cloud storage. With a StatefulSet volumeClaimTemplate, scaling from three to five replicas can trigger claims and volumes for the new Pods. The selected disk and topology depend on the StorageClass and driver, so check the binding mode before scheduling the workload.
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: fast-ssd
provisioner: ebs.csi.aws.com
parameters:
type: gp3
csi.storage.k8s.io/fstype: ext4
iops: "3000"
throughput: "125"
volumeBindingMode: WaitForFirstConsumer
With WaitForFirstConsumer, provisioning or binding waits until a consuming Pod can be considered by the scheduler. This is useful when a CSI driver or local PV has topology constraints: the scheduler can choose a feasible node before the volume is provisioned or bound. Use it only when the provisioner supports delayed binding. Immediate can be appropriate for globally accessible storage or for a prebinding workflow that intentionally binds before a consumer Pod exists. Neither mode guarantees a particular cost or latency outcome; verify the driver’s topology and backend behavior.
StorageClass providers
Different storage providers and systems expose different provisioners:
| Storage system | Example provisioner | Notes |
|---|---|---|
| AWS EBS | ebs.csi.aws.com | CSI driver must be installed and configured |
| Google Compute Engine disks | pd.csi.storage.gke.io | Check supported disk types and topology with the driver |
| Azure Disk | disk.csi.azure.com | Check supported disk types and topology with the driver |
| NFS | nfs.csi.k8s.io | Requires a reachable NFS server and compatible CSI driver |
| Local PV | kubernetes.io/no-provisioner | Static PVs; use node affinity and a suitable binding mode |
AWS EBS StorageClass
The EBS CSI driver provisions AWS block volumes. Volume types, IOPS, throughput, expansion, and topology are provider-specific; check current AWS and driver limits before choosing parameters. The fsType parameter controls the filesystem format for a new filesystem, but changing an existing volume’s filesystem requires a data migration. Set allowVolumeExpansion only when the StorageClass’s driver and backend support the expansion path your workload needs.
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: gp3-storage
provisioner: ebs.csi.aws.com
parameters:
type: gp3
csi.storage.k8s.io/fstype: ext4
iops: "3000"
throughput: "125"
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
The allowVolumeExpansion: true field permits PVC expansion when the storage driver supports it. Increase the requested PVC size, then check the PVC, PV, filesystem, and application to confirm expansion completed. Some drivers require a pod restart or a separate filesystem resize step.
NFS StorageClass
An NFS CSI driver can provide a shared filesystem when the server, export configuration, and application support the intended concurrent access. RWX only describes the requested mount capability; it does not supply application locking or guarantee safe writes. Confirm permissions, locking behavior, and failure handling against your NFS server and driver. The example uses the community NFS CSI provisioner; its parameters and support policy must match the installed driver. The nfsvers mount option selects a protocol version; authentication depends on the NFS server and mount configuration.
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: nfs-storage
provisioner: nfs.csi.k8s.io
parameters:
server: nfs-server.example.com
share: /exports
mountOptions:
- nfsvers=4.1
volumeBindingMode: Immediate
StatefulSet volume claim templates
StatefulSets use volumeClaimTemplates to provision storage for each replica automatically:
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: postgres-cluster
namespace: database
spec:
serviceName: postgres-cluster
replicas: 3
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: postgres:15
volumeMounts:
- name: data
mountPath: /var/lib/postgresql/data
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: fast-ssd
resources:
requests:
storage: 100Gi
For StatefulSet with 3 replicas, Kubernetes creates 3 PVCs: data-postgres-cluster-0, data-postgres-cluster-1, data-postgres-cluster-2. Each PVC binds to its own PV with independent lifecycle.
When you scale down the StatefulSet, its PVCs normally remain unless the StatefulSet PVC retention policy is configured otherwise. This preserves a claim; it does not back up the data or make the application replication-safe. Review the retention policy and PV reclaim policy before deleting claims.
CSI drivers and abstraction
The Container Storage Interface (CSI) is the standard API between Kubernetes and external storage drivers. For cloud storage in Kubernetes v1.37.1, use the provider’s supported CSI driver rather than starting new work with legacy in-tree plugin examples.
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: ebs-sc
provisioner: ebs.csi.aws.com
parameters:
type: gp3
csi.storage.k8s.io/fstype: ext4
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
CSI drivers run as Pods and communicate with the storage provider. Cloud providers and community projects maintain drivers for services such as AWS EBS and Google Persistent Disk.
CSI drivers expose a common Kubernetes interface, but they do not make backend features identical. Provisioning, attachment limits, access modes, topology, expansion, snapshots, and recovery depend on the installed driver and storage system.
Install and maintain the driver components, controller, node plugin, and any required sidecars according to the provider’s compatibility matrix.
Data backup considerations
PersistentVolumes do not get backed up automatically. You need explicit backup strategies:
Volume snapshots
CSI volume snapshots require the snapshot API CRDs, the snapshot controller, the CSI snapshot sidecar, and a driver/backend that supports snapshots. A snapshot is a storage-level point-in-time copy; it does not necessarily quiesce an application or make a multi-volume database backup consistent. Use the application’s backup or quiescing procedure when consistency requires it. A snapshot object is separate from a PVC, but it is not a backup by itself: its availability and retention depend on the storage backend and snapshot configuration.
The VolumeSnapshotClass selects the CSI driver and driver-specific parameters. Not all drivers or backends support snapshots, and supported limits vary.
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshot
metadata:
name: postgres-snapshot
namespace: database
spec:
volumeSnapshotClassName: ebs-snapshot-class
source:
persistentVolumeClaimName: data-postgres-cluster-0
Backup tools
Choose a backup method that captures both the application data and the Kubernetes resources needed to restore it. A tool may use CSI snapshots, filesystem-level backups, or provider APIs depending on its configuration and plugins. Confirm which method is actually configured for the workload.
For example, a configured Velero installation can back up Kubernetes resources and use a supported data-mover or volume backup integration. The exact behavior depends on the installed plugins and backup configuration:
velero backup create database-backup --include-namespaces database
velero restore create --from-backup database-backup
Verify a backup by restoring it
Run a restore drill before you rely on the backup:
- Create a backup using the application’s consistency procedure. For databases, use a native backup or quiesce writes as required. A CSI snapshot alone may be only crash-consistent.
- Restore to a new PVC, preferably in an isolated namespace or test cluster. A
VolumeSnapshotis namespace-scoped, so a snapshot-based restore in another namespace needs a supported copy or backup-tool workflow. - Start a test instance with the restored PVC and keep it isolated from production services and credentials.
- Check actual application data: run the database’s integrity checks, verify expected records or files, and confirm ownership and permissions.
- Record how long restore took and the point in time recovered. Keep the source backup and PVC until the check passes.
StatefulSet identity, PVC retention, and snapshots do not replace this restore test.
Trade-off analysis
Storage choices depend on the workload, operations, and provider. These comparisons summarize the main trade-offs.
Static vs. dynamic provisioning comparison
| Aspect | Static Provisioning | Dynamic Provisioning |
|---|---|---|
| Control | Admin creates PVs manually | StorageClass provisions PVs automatically |
| Utilization | May leave storage unused | Better utilization: PVs created on demand |
| Operational burden | High: manual tracking | Low: automated |
| Use case | Pre-allocated storage, local disks | Cloud block storage, elastic workloads |
Access mode comparison
| Mode | What it requests | What it does not guarantee |
|---|---|---|
| RWO | Read-write use from one node | One Pod only, app-level locking, or cross-node failover without detach |
| RWOP | Read-write use by one Pod | Support from every CSI driver or sidecar version |
| ROX | Read-only use from multiple nodes | That other clients cannot write through another mount |
| RWX | Read-write use from multiple nodes | Support from the backend or safe concurrent application writes |
Check the driver and storage backend documentation before designing around an access mode.
VolumeBindingMode: Immediate vs. WaitForFirstConsumer
| Situation | Binding mode to consider | Why |
|---|---|---|
| Topology-constrained CSI volume or local PV | WaitForFirstConsumer |
Lets scheduling account for the consumer’s feasible topology before provisioning or binding |
| Globally accessible storage with no consumer-dependent placement | Immediate may fit |
The volume can be provisioned or bound before a Pod is scheduled |
| Intentional prebinding to a static PV | Depends on the PV and workflow | Binding before a consumer exists may be the intended result |
For dynamic CSI volumes, confirm that the driver supports delayed binding and topology-aware provisioning. WaitForFirstConsumer does not guarantee lower cost or higher availability; those depend on the topology, backend, and workload.
Reclaim policies
| Policy | PVC deletion consequence | Operational consequence |
|---|---|---|
| Retain | PV and backing data are kept | An administrator must reclaim, wipe, or rebind the storage manually |
| Delete | PV and backing storage are deleted when supported | A deleted claim can result in permanent data loss |
The reclaim policy is set on the PV. A dynamically provisioned PV uses its StorageClass reclaim policy; if the class omits it, the default is commonly Delete. The exact deletion behavior depends on the driver and provider. Check the bound PV before deleting a PVC. Recycle is deprecated and should not be treated as a normal option.
StatefulSet volumeClaimTemplates vs. manual PVCs
| Aspect | volumeClaimTemplates (automatic) | Manual PVCs |
|---|---|---|
| Scaling | New PVC + PV auto-created per replica | Admin must create manually |
| Lifecycle | Independent per replica | Independent per PVC |
| Naming | Predictable naming pattern | Must track names manually |
| Deletion on scale-down | PVCs remain (must clean manually) | Same: manual cleanup |
Common pitfalls and anti-patterns
Treating an access mode as a write-safety guarantee
Access modes help Kubernetes match a claim to a volume and can affect where a volume is mounted. They do not coordinate writes between application processes. RWO can be used by multiple Pods on the same node. RWX is valid only when the driver and backend provide the requested multi-node capability, and even then the application may need its own locking or consistency protocol. For a single-Pod mount requirement, consider RWOP if the CSI driver and required sidecars support it. Check backend attachment and failover behavior before planning rescheduling.
Choosing a binding mode without checking topology
WaitForFirstConsumer is useful when the provisioner or local PV has topology constraints. It delays binding or dynamic provisioning until a consuming Pod can be scheduled with those constraints in view. It is not a universal default: globally accessible storage or an intentional prebinding workflow may work better with Immediate.
For dynamic CSI provisioning, check that the driver supports delayed binding and topology-aware provisioning. With WaitForFirstConsumer, avoid setting spec.nodeName on the Pod: that bypasses the scheduler and can leave the PVC Pending. Use node selectors or affinity when placement constraints are needed so the scheduler can evaluate them.
Manually creating PVs for StatefulSets
For dynamically provisioned storage, StatefulSets commonly use volumeClaimTemplates so each replica gets its own PVC. Static or prebound PVs can still be appropriate when storage is allocated outside Kubernetes or has a fixed location.
Manual PVs for StatefulSets create naming and lifecycle headaches. StatefulSet replicas get predictable ordinal names: postgres-cluster-0, postgres-cluster-1, postgres-cluster-2. If you create PVs manually, you have to name them consistently and track which PV belongs to which replica. When you scale up to 5 replicas, you have to pre-create 2 more PVs before the StatefulSet can schedule the new pods. When you scale down, the PVs do not get deleted automatically, so you have to clean them up manually too.
volumeClaimTemplates handles this automatically. Each replica gets its own PVC with a generated name like data-postgres-cluster-0 that includes the StatefulSet name and ordinal. When you scale up, Kubernetes creates the new PVC and the provisioner creates the new PV automatically. When you scale down, the PVCs persist (by design, to protect data), and you handle cleanup when you are ready.
Manual PVs can fit pre-allocated storage such as a specific NFS export, a SAN LUN, or local disks. Choose based on the storage lifecycle and driver capabilities, not on a blanket preference for dynamic provisioning.
Production failure scenarios
PVC remains Pending
A PVC can remain Pending because it is waiting for a consumer Pod, no static PV matches, provisioning failed, or no feasible topology is available. Pending alone does not identify the cause.
Start with the claim, its StorageClass, and any Pod that uses it:
kubectl describe pvc <name> -n <namespace>
kubectl get pvc <name> -n <namespace> -o yaml
kubectl get storageclass <class-name> -o yaml
kubectl describe pod <consumer-pod> -n <namespace>
Then check the PVC events and spec, StorageClass provisioner and volumeBindingMode, requested capacity and access mode, volume mode, namespace quota, and storage topology. For CSI drivers, inspect events and logs for both the controller and node plugin in the namespace where the driver is installed. Check whether the driver publishes capacity information when its provisioning flow uses it.
Use the events to separate scheduling from provisioning:
- With
WaitForFirstConsumer, a Pending claim may be expected until a consumer Pod can be scheduled. If the Pod hasFailedSchedulingevents, check resource requests, node selectors or affinity, taints, and topology constraints. A Pod withspec.nodeNamebypasses the scheduler and can leave a WFFC claim Pending; replace that placement with scheduler constraints. - If the consumer is schedulable but claim events show
ProvisioningFailed, or the CSI controller reports an error, investigate the provisioner, driver credentials, backend quota/capacity, requested size/mode, and supported topology. - For static provisioning, compare the claim’s class, size, volume mode, and access modes with available PVs and their node affinity.
Correct the mismatched request, scheduling constraint, quota, or driver/backend issue and let the claim reconcile. Do not delete a PVC or PV as a diagnostic shortcut: the PV reclaim policy may delete the backing data. If a claim must be replaced, first verify application backups and the exact consequences for its bound PV.
Pod fails to start because a volume mount times out
If a volume is mounted from a remote storage system and the network path is slow or unavailable, the pod can fail to start within the default mount timeout.
Symptoms: ContainerCreating state, MountVolume.SetUp timed out in events.
Mitigation: Check Pod events, CSI node plugin logs, node health, network reachability, and backend attachment limits. Fix the underlying timeout cause; mountOptions do not generally set Kubernetes mount timeouts.
Volume capacity exhaustion
When a PersistentVolume fills up, writes to it fail. A database may stop accepting writes or fail, depending on how it handles the error.
Symptoms: No space left on device errors in application logs. The process may crash if it cannot handle failed writes.
Mitigation: Check whether the StorageClass, driver, and backend support expansion. If supported, request a larger PVC and verify the PV, filesystem, and application reflect the new capacity. Monitor capacity and clean up data according to application policy.
Interview Questions
Expected answer points:
- PV is the actual storage resource in the cluster: cluster-wide, not namespace-scoped
- PVC is a request for storage by a user or pod: namespace-scoped
- A PVC binds to a PV that matches capacity, access modes, volume mode, and StorageClass requirements
- The PV lifecycle is independent of the pod lifecycle: PV survives pod restarts
Expected answer points:
- Retain: PV and backing data remain after PVC deletion; an administrator must reclaim the volume manually.
- Delete: the PV and backing storage are deleted when supported by the driver/provider. Check the reclaim policy before deleting a claim.
- Recycle is deprecated and is not a normal choice for current clusters.
Expected answer points:
- Static: admin creates PVs manually before any PVC requests. Gives precise control but requires manual tracking.
- Dynamic: StorageClass provisions PVs automatically when a PVC requests storage and no matching PV exists.
- Dynamic provisioning is common for cloud workloads where storage is elastic.
- Static is useful when you have pre-allocated storage or local disks.
Expected answer points:
- ReadWriteOnce (RWO): read-write use from one node; multiple Pods on that node may use the volume.
- ReadOnlyMany (ROX) and ReadWriteMany (RWX) work only when the CSI driver and backend support the requested mode.
- ReadWriteOncePod (RWOP) requests use by one Pod and requires a compatible CSI driver and sidecars.
- Access modes match claims to volumes and may affect placement; they do not provide app-level locking or guarantee safe shared writes.
Expected answer points:
- WaitForFirstConsumer delays binding/provisioning until a consumer Pod can be scheduled with topology constraints in view.
- For dynamic CSI volumes, the driver must support delayed binding and topology-aware provisioning.
- Immediate can fit globally accessible storage or a workflow that intentionally prebinds a volume before a Pod exists.
- With WaitForFirstConsumer, spec.nodeName bypasses the scheduler and can leave the PVC Pending; use node selectors or affinity instead.
Expected answer points:
- A StorageClass defines the provisioner (e.g., AWS EBS, NFS) and parameters for creating PVs
- When a PVC specifies a StorageClass and no matching PV exists, the provisioner creates a new PV automatically
- StorageClasses are the foundation of dynamic provisioning in Kubernetes
- You can set default StorageClasses with annotation `storageclass.kubernetes.io/is-default-class`
Expected answer points:
- volumeClaimTemplates can create a separate PVC for each StatefulSet replica.
- PVC retention and PV reclaim policy determine what happens to storage during scale-down and deletion.
- Pod names are stable (e.g., postgres-cluster-0, postgres-cluster-1) for stable network identities
- Stable Pod identity and per-replica claims do not make the application replication-safe or back up its data.
Expected answer points:
- CSI (Container Storage Interface) is a standard interface for storage plugins
- CSI defines an interface for storage drivers to expose supported operations to Kubernetes.
- Driver controllers and node plugins are installed and maintained separately from the Kubernetes API server.
- The interface is standardized; actual features still depend on the driver and backend.
Expected answer points:
- PVs are not backed up automatically: you need explicit backup strategies
- CSI snapshots require the snapshot API components and support from the installed driver/backend.
- A storage snapshot may be crash-consistent and does not replace an application-consistent backup.
- Restore to a separate PVC or isolated namespace, start a test application, and verify real data before relying on the backup.
Expected answer points:
- Check which modes the CSI driver and backend support, along with attachment and topology limits.
- RWO means one node and can allow multiple Pods on that node; it is not a one-Pod or locking guarantee.
- Consider RWOP when one-Pod use is required and the CSI driver and sidecars support it.
- Use RWX only when the backend supports it and the application can safely coordinate concurrent access.
Expected answer points:
- Set `allowVolumeExpansion: true` on the StorageClass
- Edit the PVC spec to request more storage (e.g., `kubectl edit pvc
`) - The CSI driver handles the actual volume expansion on the storage backend
- Not all storage providers support online expansion: some require pod restart
Expected answer points:
- When a StatefulSet is scaled down, the pods are terminated but their PVCs are NOT deleted
- The PVCs usually remain in the cluster unless a retention policy says otherwise; retained claims are not backups.
- When scaled back up, a Pod ordinal can reuse its retained PVC.
- Review the StatefulSet PVC retention policy and PV reclaim policy before cleaning up claims.
Expected answer points:
- 1. Provisioning: PV created statically by admin or dynamically by StorageClass
- 2. Binding: PVC binds to a PV that satisfies its requirements
- 3. Using: Pod uses the mounted volume
- 4. Releasing: a claim is deleted after its consumers no longer need it
- 5. Reclaiming: the PV reclaim policy determines whether the backing storage is retained or deleted
Expected answer points:
- hostPath mounts a directory from the host node: simple but not portable across nodes
- Local PV uses a dedicated block device or partition on a local disk: scheduler knows node affinity
- Local PVs carry node affinity to the node holding the storage and can improve local I/O; they are tied to that node, not generally to an availability zone.
- Both are static provisioning: you create the PV manually with the `no-provisioner` StorageClass
Expected answer points:
- Use `kubectl describe pvc` and inspect its events, StorageClass, binding mode, requested size, access mode, and volume mode.
- Describe the consumer Pod and check scheduling events, quota, node constraints, and topology.
- For CSI errors, inspect the driver controller and node plugin events/logs in their actual installation namespace.
- Distinguish a WFFC claim waiting for a schedulable consumer from a CSI provisioning failure; do not delete the claim or PV before checking the reclaim policy and backup.
Expected answer points:
- Volume expansion only works if the StorageClass has `allowVolumeExpansion: true`
- CSI drivers must support online expansion: some require the pod to be stopped before expanding
- You can only expand, not shrink: be careful about requesting too much storage upfront
- Expanding a volume does not automatically increase the filesystem size inside: the application may need to handle filesystem resizing
Expected answer points:
- Storage provider outage: a cloud volume may become unavailable, blocking mounts or I/O. Kubernetes does not automatically evict every affected Pod.
- Topology or attachment mismatch: a volume may not be usable from the consumer's scheduled node
- Storage quota exhaustion: reaching provider storage limits blocks new PVCs
- Deleting a PVC without checking reclaim policy can permanently lose data if the PV was set to Delete
Expected answer points:
- Confirm the CSI driver's supported provisioning options and the NFS server/export configuration.
- Check access controls, permissions, locking semantics, and how the application handles concurrent clients.
- RWX signals a requested mount mode; it does not create application-level locking or guarantee safe shared writes.
- Use a binding mode appropriate for the backend; globally accessible NFS storage may be provisioned with Immediate.
Expected answer points:
- CSI drivers can advertise topology constraints (region, zone, node) for each volume they can provision
- With driver support, `WaitForFirstConsumer` lets scheduling account for advertised topology before provisioning or binding.
- A topology can limit eligible nodes even when capacity exists elsewhere; inspect scheduler and CSI events to identify the constraint.
- Topology-aware placement can avoid an unsupported attachment, but does not guarantee availability during a zone or backend outage.
Expected answer points:
- You cannot change the StorageClass of an existing PV: migration requires creating a new PVC with the new StorageClass
- Use a configured backup tool to restore application resources and data to a new PVC or isolated namespace using the intended StorageClass.
- For databases, use native backup/restore (pg_dump, mysqldump) to move data to a new volume with the desired StorageClass
- Plan cutover at the application level: pause writes or use the application's replication or migration procedure, verify the new volume, and retain the old PVC until validation passes. Scaling a single-writer database against copied data can cause divergence.
Further Reading
- Kubernetes v1.37 release information
- Persistent Volumes and Claims
- Storage Classes
- Storage Capacity
- Volume Snapshots
- Change a PV access mode to ReadWriteOncePod
Conclusion
Use this checklist when working with Kubernetes storage:
- Confirmed the CSI driver and backend support the access mode, attachment pattern, and topology the workload needs.
- Chose
WaitForFirstConsumerfor a topology-constrained provisioner that supports delayed binding; useImmediatewhen it fits global storage or an intentional prebinding workflow. - Avoided
spec.nodeNamewhen a WFFC claim depends on scheduler placement. - Checked StorageClass expansion support before requesting a larger PVC.
- Reviewed StatefulSet PVC retention and PV reclaim policy before scaling down or deleting claims.
- Confirmed snapshot controller/CSI support when using VolumeSnapshots.
- Restored a backup to a separate PVC or isolated namespace and checked application data.
- Monitored requested capacity, backend quota, and topology constraints.
- Used node affinity and a suitable binding mode for local PVs.
PersistentVolumes, PersistentVolumeClaims, and StorageClasses connect Pods to storage, but the CSI driver and backend determine the actual capabilities. Check matching, attachment, topology, reclaim, and snapshot behavior before relying on it. For StatefulSet workload design, see the Kubernetes Workload Resources post.
A PVC that survives a Pod restart is still not a backup. Use an application-consistent backup where required, then restore it to a separate PVC and verify the application data.
Category
Related Posts
Docker Volumes: Persisting Data Across Container Lifecycles
Understand how to use Docker volumes and bind mounts to persist data, share files between containers, and manage stateful applications.
Artifact Management: Build Cache, Provenance, and Retention
Manage CI/CD artifacts effectively—build caching for speed, provenance tracking for security, and retention policies for cost control.
Container Security: Image Scanning and Vulnerability Risks
Implement comprehensive container security: from scanning images for vulnerabilities to runtime security monitoring and secrets protection.