Creating a PersistentVolumeClaim (PVC)

Create a PersistentVolumeClaim (PVC) YAML file for an NVMe‑oF backed persistent volume (PV).

About this task

A PVC is a request for abstract storage resources by a user. The PVC is associated with a Pod resource to provision a persistent volume (PV) that is backed by an NVMe‑oF gateway.

  • Specify the accessModes value as ReadWriteOnce.
  • Be sure to use the same StorageClass that was created in Creating a StorageClass when configuring the storageClassName.

Procedure

  1. Create the PVC file, similar to the following nvmeof-pvc.yaml file.
    kind: PersistentVolumeClaim
    metadata:
      name: nvmeof-pvc
    spec:
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: 10Gi
      storageClassName: ceph-nvmeof-sc
  2. Apply the PVC, by using the kubectl apply command.
    kubectl apply -f FILENAME.YAML
    The persistentvolumeclaim/PVC_NAME created message is emitted.

What to do next

Verify that the PVC is in a bound state, by using the kubectl get pvc command.
For example,
host01$ kubectl get pvc
NAME        STATUS  VOLUME                                     CAPACITY ACCESS MODES STORAGECLASS    AGE
nvmeof-pvc  Bound   pvc-7a9e3d1e-3f24-4b9d-9f7b-02c6c1a3a0a1     10Gi     RWO          ceph-nvmeof-sc 2m

After the PVC is bound, bind the PVC to a Pod resource. For more information, see Binding a PersistentVolumeClaim to a Pod resource.