Persistent volumes

Configure persistent volumes (PVs) with capacity, access modes, mount options, and reclaim policies to manage cluster-wide storage resources across their lifecycle phases.

Each storage backend supports different access mode combinations, and volumes transition through phases (Available, Bound, Released, Failed) affecting claim availability.

Each PV contains a spec and status, which is the specification and status of the volume, for example:

Example PersistentVolume object definition
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv0001
spec:
  capacity:
    storage: 5Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  ...
status:
  ...
  • metadata.name: Specifies the name of the persistent volume.

  • spec.storage: Specifies the amount of storage available to the volume.

  • spec.accessModes: Specifies the access mode, defining the read/write and mount permissions.

  • spec.persistentVolumeReclaimPolicy: Specifies the reclaim policy, indicating how the resource should be handled once it is released.

You can view the name of a PVC that is bound to a PV by running the following command:

$ oc get pv <pv_name> -o jsonpath='{.spec.claimRef.name}'