Let's perform the following steps to create a new storage class to consume StoragePool, which we created previously in the Creating storage pools recipe:
- Create an OpenEBS cStor storage class using the cStor StoragePoolClaim name, cstor-disk-pool, with three replicas:
$ cat <<EOF | kubectl apply -f -
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: openebs-cstor-default
annotations:
openebs.io/cas-type: cstor
cas.openebs.io/config: |
- name: StoragePoolClaim
value: "cstor-disk-pool"
- name: ReplicaCount
value: "3"
provisioner: openebs.io/provisioner-iscsi
EOF
- List the storage classes:
$ kubectl get sc
NAME PROVISIONER AGE
default kubernetes.io/aws-ebs 25m
gp2 (default) kubernetes.io/aws-ebs 25m
openebs-cstor-default openebs.io/provisioner-iscsi 6s
openebs-device openebs.io/local 20m
openebs-hostpath openebs.io/local 20m
openebs-jiva-default openebs.io/provisioner-iscsi 20m
openebs-snapshot-promoter volumesnapshot.external-storage.k8s.io/snapshot-promoter 20m
ubun
- Set the gp2 AWS EBS storage class as the non-default option:
$ kubectl patch storageclass gp2 -p '{"metadata": {"annotations":{"storageclass.beta.kubernetes.io/is-default-class":"false"}}}'
- Define openebs-cstor-default as the default storage class:
$ kubectl patch storageclass openebs-cstor-default -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
Make sure that the previous storage class is no longer set as the default and that you only have one default storage class.