Binding a PersistentVolumeClaim to a Pod resource

Bind a PersistentVolumeClaim to a Pod resource by using an NVMe‑oF backed persistent volume.

Procedure

  1. Bind the Pod to the PVC file created in Creating a PersistentVolumeClaim (PVC).
    Create a Pod YAML file similar to the following nvmeof-pod.yaml file.
    kind: Pod
    metadata:
      name: pod-with-nvmeof-volume
    spec:
      containers:
      - name: app-container
        image: busybox
        command: ["sleep", "infinity"]
        volumeDevices:
        - name: nvmeof-volume
          devicePath: /dev/nvmeofblock
      volumes:
      - name: nvmeof-volume
        persistentVolumeClaim:
          claimName: nvmeof-pvc
  2. Apply the Pod, by using the kubectl apply command.
    kubectl apply -f FILENAME.YAML
    The pod/POD_NAME created message is emitted.

What to do next

Verify that the Pod is running and the volume is attached by using the kubectl get pods command.
For example,
host01$ kubectl get pods
NAME                     READY   STATUS    RESTARTS   AGE
pod-with-nvmeof-volume   1/1     Running   0          1m