Sign In

Curriculum 17: Storage & Volumes

Persistent Volume Claims

15 min · 25 XP

Persistent Volume Claims

A PersistentVolumeClaim (PVC) is a request for storage by a user. PVCs consume PV resources, similar to how pods consume node resources. When you create a PVC, Kubernetes finds a matching PV and binds them together.

Creating a PVC

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: app-data-claim
  namespace: default
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
  storageClassName: standard
kubectl apply -f pvc.yaml
kubectl get pvc app-data-claim

How Binding Works

Kubernetes matches a PVC to a PV based on access mode, storage capacity, and storage class. The PV must have at least the requested capacity. Once bound, the relationship is one-to-one -- no other PVC can claim the same PV.

# Check binding status
kubectl get pvc app-data-claim
# STATUS should show "Bound"

Using a PVC in a Pod

apiVersion: v1
kind: Pod
metadata:
  name: data-pod
spec:
  containers:
    - name: app
      image: nginx
      volumeMounts:
        - mountPath: /usr/share/nginx/html
          name: data-volume
  volumes:
    - name: data-volume
      persistentVolumeClaim:
        claimName: app-data-claim

Inspecting PVC Details

kubectl describe pvc app-data-claim
kubectl get pvc -o wide

The describe output shows the bound PV, capacity, access modes, and storage class. If a PVC remains in Pending status, it means no matching PV is available -- check that the requested size, access mode, and storage class align with existing PVs or that dynamic provisioning is configured.