What is a PersistentVolumeClaim?

· Category: Kubernetes

Short answer

A PersistentVolumeClaim (PVC) is a request for storage by a user or application. It specifies size and access modes. Kubernetes binds the PVC to a suitable PersistentVolume and mounts it into the requesting Pod.

How it works

When a PVC is created, the control plane searches for a matching PV or provisions one dynamically via a StorageClass. Once bound, the PVC can be referenced in a Pod spec. The volume is mounted at the specified path inside the container.

Example

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: myclaim
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
  storageClassName: standard

Use in a Pod:

volumes:
- name: data
  persistentVolumeClaim:
    claimName: myclaim

Why it matters

PVCs allow developers to request storage without knowing the underlying infrastructure. They enable portability across environments and simplify storage management for stateful applications.

Common issues

  • PVCs remain in Pending if no matching PV or StorageClass exists.
  • Expansion requires the storage driver to support volume resizing.
  • A PVC can only be used by one Pod at a time for ReadWriteOnce.