Kubernetes Persistent Volume Claims (PVCs)

Persistent Volume Claims (PVCs) are requests for storage by users in Kubernetes. They abstract the underlying storage details, allowing users to consume storage resources without needing to know the specifics of the provisioned Persistent Volumes (PVs) or StorageClasses. A PVC represents a claim for storage of a certain size and access mode (e.g., ReadWriteOnce, ReadOnlyMany).

Listing Persistent Volume Claims (PVCs)

You can list PVCs in various scopes using kubectl get pvc.

List PVCs in the Current Namespace

kubectl get pvc

List PVCs Across All Namespaces

kubectl get pvc --all-namespaces

List PVCs in a Specific Namespace

kubectl get pvc -n <namespace>
# Example:
kubectl get pvc -n uat

Describing a Persistent Volume Claim (PVC)

To get detailed information about a specific PVC, including its current status, associated Persistent Volume (PV), access modes, capacity, and events, use kubectl describe pvc. This command is invaluable for debugging storage-related issues.

kubectl describe pvc <pvc-name> -n <namespace>
# Example:
kubectl describe pvc unify-config-pvc -n uat

Key Information from describe pvc:

  • Status: Indicates whether the PVC is Pending (waiting for a PV to be provisioned) or Bound (successfully connected to a PV).
  • Volume: The name of the Persistent Volume to which this PVC is bound.
  • Capacity: The requested storage capacity.
  • Access Modes: How the volume can be mounted (e.g., ReadWriteOnce, ReadOnlyMany).
  • StorageClass: The StorageClass used for dynamic provisioning.
  • Events: A history of events related to the PVC, useful for troubleshooting binding failures.
  • Persistent Volumes (PVs): The actual storage resources in the cluster. You can view them with kubectl get pv.
  • StorageClasses: Define the “classes” of storage available, allowing dynamic provisioning of PVs when a PVC requests storage. View them with kubectl get sc.