Rate This Document
Findability
Accuracy
Completeness
Readability

Creating a PVC

Kubernetes provides a set of APIs called the PersistentVolume subsystem, which provides a storage abstraction layer for users and administrators. PersistentVolume (PV) represents the actual storage, and PersistentVolumeClaim (PVC) represents users' storage requests. This abstraction layer separates the details of how storage is provisioned from the details of how storage is used, providing more efficient storage management for users and administrators. Create a PVC by configuring and applying the YAML file on the Kubernetes management node.

  1. Create a raw-block-pvc.yaml file on the master node.
    vi raw-block-pvc.yaml
  2. Press i to enter the insert mode and add the following content to the raw-block-pvc.yaml file:
    --- 
    apiVersion: v1 
    kind: PersistentVolumeClaim 
    metadata: 
      name: raw-block-pvc 
    spec: 
      accessModes: 
        - ReadWriteOnce 
      volumeMode: Block 
      resources: 
        requests: 
          storage: 1Gi 
      storageClassName: csi-rbd-sc
  3. Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
  4. Use the YAML file to create a PVC.
    kubectl apply -f raw-block-pvc.yaml
  5. Check whether the PVC is successfully created.
    kubectl get pvc

    Expected result: