Skip to content

PersistentVolumes, PVCs, and StorageClasses

Storage in Kubernetes — PV/PVC binding, dynamic provisioning via StorageClass, reclaim policies, access modes, and the migration paths that matter.

A PersistentVolume (PV) is a piece of storage in the cluster. A PersistentVolumeClaim (PVC) is a workload’s request for storage. A StorageClass is the recipe that turns a PVC into a PV without you doing the wiring. This article covers what each is, how binding works, how dynamic provisioning happens through CSI drivers, the reclaim policies that determine what happens when you delete a PVC, and the gotchas around access modes and volume binding that bite at scale.

How to verify

The state of storage in the cluster:

kubectl get sc
kubectl get pv
kubectl get pvc -A
kubectl get csidrivers

get sc shows StorageClasses (and which one is default — the line marked (default)). get pv lists existing volumes with capacity, access modes, reclaim policy, and which PVC each is bound to. get pvc -A lists every claim and its bound PV. get csidrivers shows registered CSI drivers — the ones that can actually provision.

For one PVC, inspect the binding and events:

kubectl describe pvc data -n team-payments
kubectl get events -n team-payments --sort-by=.lastTimestamp | grep -i volume

What’s happening

A PV represents storage that exists or can be created. It has capacity, access modes, a reclaim policy, and a backing source (NFS export, EBS volume, hostPath, CSI driver). A PVC is the workload-side request: “I need 50 GiB, RWO access, on the fast StorageClass.” When a PVC is created, the binder tries to match it to a PV — either an existing static PV that satisfies the request, or by asking the StorageClass’s provisioner to create a new one. Binding is exclusive (one PVC per PV).

A StorageClass names a provisioner (kubernetes.io/aws-ebs, csi.example.com, kubernetes.io/no-provisioner for static) and a parameter set the provisioner understands (volume type, IOPS, encryption, fsType). volumeBindingMode: WaitForFirstConsumer defers provisioning until a Pod using the PVC is scheduled, so the volume lands in the right zone — important on any cloud that scopes volumes per AZ. reclaimPolicy (Retain or Delete) controls whether deleting the PVC also deletes the backing volume.

CSI is the standard interface. In-tree drivers (the ones built into kubelet years ago) are deprecated; the modern story is a CSI driver Deployment + DaemonSet that the StorageClass references. The driver does the actual cloud-API calls.

Access modes are the source of most confusion. ReadWriteOnce (RWO) means one node at a time can mount the volume — fine for most block storage. ReadWriteMany (RWX) means many nodes simultaneously — only supported by network filesystems (NFS, EFS, CephFS). ReadOnlyMany (ROX) is rare. ReadWriteOncePod (RWOP) is a stricter RWO — only one Pod, not just one node — useful for leader-election workloads.

The procedure

  1. List StorageClasses and pick one (or accept the default). On EKS this is typically gp3 via the AWS EBS CSI driver; on GKE, standard-rwo via the PD CSI driver.

    kubectl get sc -o custom-columns=NAME:.metadata.name,PROVISIONER:.provisioner,RECLAIM:.reclaimPolicy,BINDMODE:.volumeBindingMode,DEFAULT:.metadata.annotations.storageclass\\.kubernetes\\.io/is-default-class
  2. Create a StorageClass with the parameters you want if the defaults don’t fit. This one is for AWS EBS gp3 with WaitForFirstConsumer:

    apiVersion: storage.k8s.io/v1
    kind: StorageClass
    metadata:
      name: fast
    provisioner: ebs.csi.aws.com
    parameters:
      type: gp3
      iops: "3000"
      throughput: "125"
      encrypted: "true"
    reclaimPolicy: Retain
    volumeBindingMode: WaitForFirstConsumer
    allowVolumeExpansion: true
  3. A PVC that uses it. Storage size is a request; the provisioner picks the actual size (rounded up to whatever the cloud allows):

    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: data
      namespace: team-payments
    spec:
      storageClassName: fast
      accessModes: ["ReadWriteOnce"]
      resources:
        requests:
          storage: 50Gi
  4. Mount it in a Pod. The classic “name a volume, mount it at a path” pattern:

    spec:
      containers:
        - name: app
          image: registry.example.com/app:1.2.0
          volumeMounts:
            - name: data
              mountPath: /var/lib/app
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: data
  5. Expand a volume without recreating the Pod. The StorageClass must have allowVolumeExpansion: true; some drivers need a Pod restart to pick up the new size on the filesystem.

    kubectl patch pvc data -n team-payments --type=merge \
      -p '{"spec":{"resources":{"requests":{"storage":"100Gi"}}}}'
    kubectl get pvc data -n team-payments -o jsonpath='{.status.conditions}'
  6. Statically provision a PV for an existing volume (NFS share, pre-created EBS volume) — useful for migrations. Match the PV’s storageClassName to a PVC that requests the same:

    apiVersion: v1
    kind: PersistentVolume
    metadata: { name: legacy-data }
    spec:
      capacity: { storage: 200Gi }
      accessModes: ["ReadWriteOnce"]
      persistentVolumeReclaimPolicy: Retain
      storageClassName: ""
      nfs:
        server: nfs.example.com
        path: /export/legacy
  7. Snapshot and restore with VolumeSnapshot (CSI), where the driver supports it. The class binds to a snapshotter:

    apiVersion: snapshot.storage.k8s.io/v1
    kind: VolumeSnapshot
    metadata:
      name: data-2026-06-02
      namespace: team-payments
    spec:
      volumeSnapshotClassName: csi-aws-vsc
      source:
        persistentVolumeClaimName: data

Common pitfalls

  • The default reclaim policy on dynamically provisioned volumes is Delete — deleting a PVC deletes the cloud volume; for anything you would not want to lose, set reclaimPolicy: Retain on the StorageClass.
  • Immediate binding mode provisions a volume as soon as the PVC is created, in some zone the provisioner picks; the Pod that wants it may then be unschedulable because no node in that zone has capacity. Use WaitForFirstConsumer on multi-AZ clusters.
  • ReadWriteMany is not a property of the StorageClass — it’s a property of the underlying volume; EBS, GCE PD, and Azure Disk cannot do RWX, no matter what mode you request.
  • fsType defaults vary by driver — gp3 with ext4 is fine; switching to xfs later doesn’t reformat existing volumes. Set it deliberately on the StorageClass.
  • kubectl delete pvc blocks if a Pod is still using the volume — the PVC stays Terminating until the pod is gone; force-removing the finalizer leaves a dangling cloud volume.

We operate storage for clients with reclaim policies set per environment, snapshots scheduled per workload SLA, and migration runbooks for cross-StorageClass moves that don’t lose data mid-flight. See /en/services/managed-operations/.