Creating a StorageClass

Create a StorageClass YAML file in order to define the storage parameters, such as pool name, Secret reference, SpaceEfficiency, and fstype for use with Ceph Block Devices (RBD) for Ceph-CSI driver. StorageClass files are used for dynamic provisioning.

About this task

Create a storage class YAML file, similar to the following ceph-rbd-sc.yaml and update the storage parameters as needed. When configuring the file, be sure to use the same array Secret and array Secret namespace as defined in Creating a Secret.

The imageFeatures value options are: layer, journaling, exclusive-lock, object-map, or fast-diff.

Before you begin

Before you begin make sure that you have Ceph Manager (ceph-mgr) permissions. For more information, see User roles and permissions.

Procedure

  1. Create the StorageClass file, similar to the following ceph-rbd-sc.yaml file.
    Important: Use the same *-secret-name and *-secret-namespace information as was defined in Creating a Secret.
    kind: StorageClass
    metadata:
      name: ceph-rbd-sc
      annotations:
        storageclass.kubernetes.io/is-default-class: "true"
    provisioner: rbd.csi.ceph.com
    parameters:
       clusterID: 79179d9d-98d8-4976-ab2e-58635caa7235
       pool: myPool
       imageFeatures: layering
       csi.storage.k8s.io/provisioner-secret-name: ceph-admin
       csi.storage.k8s.io/provisioner-secret-namespace: default
       csi.storage.k8s.io/controller-expand-secret-name: ceph-admin
       csi.storage.k8s.io/controller-expand-secret-namespace: default
       csi.storage.k8s.io/node-stage-secret-name: ceph-admin
       csi.storage.k8s.io/node-stage-secret-namespace: default
    reclaimPolicy: Delete
    allowVolumeExpansion: true
  2. Apply the StorageClass, by using the kubectl apply command.
    kubectl apply -f FILENAME.YAML
    The storageclass.storage.k8s.io/STORAGECLASS_NAME created message is emitted.