Let's perform the following steps to create a storage class for Ceph storage.:
- Create CephBlockPool:
$ cat <<EOF | kubectl apply -f -
apiVersion: ceph.rook.io/v1
kind: CephBlockPool
metadata:
name: replicapool
namespace: rook-ceph
spec:
failureDomain: host
replicated:
size: 3
EOF
- Create a Rook Ceph block storage class:
$ cat <<EOF | kubectl apply -f -
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: rook-ceph-block
provisioner: rook-ceph.rbd.csi.ceph.com
parameters:
clusterID: rook-ceph
pool: replicapool
imageFormat: "2"
imageFeatures: layering
csi.storage.k8s.io/provisioner-secret-name: rook-ceph-csi
csi.storage.k8s.io/provisioner-secret-namespace: rook-ceph
csi.storage.k8s.io/node-stage-secret-name: rook-ceph-csi
csi.storage.k8s.io/node-stage-secret-namespace: rook-ceph
csi.storage.k8s.io/fstype: xfs
reclaimPolicy: Delete
EOF
- Confirm that the storage class has been created:
$ kubectl get sc
NAME PROVISIONER AGE
default (default) kubernetes.io/azure-disk 6h27m
rook-ceph-block rook-ceph.rbd.csi.ceph.com 3s
As you can see from the preceding provisioner name, rook-ceph.rbd.csi.ceph.com, Rook also uses CSI to interact with Kubernetes APIs. This driver is optimized for RWO pod access where only one pod may access the storage.