Abstract
The StorageClass definition is an important task in the planning and execution of OpenEBS storage. Based on the configurations made in StorageClass, cStor volume policies can also be changed. This will affect application behaviour and performance. So all granular policies available to cStor can be applied in StorageClass to tune the behaviour or performance as per the workload's need.
Step-by-Step
STEP 1
Decide the cStorPool and get the StoragePoolClaim name associated to it.
STEP 2
Decide the ReplicaCount based on application behaviour. If an application requires storage replication, then put replicaCount as 3 (Recommended). If the application can do the replication by itself, then put replicaCount and 1.
STEP 3
Are there any other storage policies to be applied to the StorageClass? Refer to the storage policy section in OpenEBS documentation for more details on the storage policies applicable to cStor.
STEP 4
Create a YAML spec file <storage-class-name.yaml> from the example configuration template below. You can update the pool name, replica count and other policies and create the class using kubectl apply -f <storage-class-name.yaml>
command.
STEP 5
Verify the newly created StorageClass using kubectl get sc command and more details of particular SC using kubectl describe sc <storage-class-name>
Example Configuration of OpenEBS StorageClass
You can create a new StorageClass YAML called openebs-sc.yaml and add content to it from below. Once you apply this SC YAML, it will create a StorageClass with the specified configuration.
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: openebs-sparse-sc-statefulset
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
Note: The default replicaCount for cStor is 3 and no need to mention with the default value in the StorageClass. In case you mention replica count as 2 in StorageClass and only single worker node in the cluster, then OpenEBS will not even create the volume itself from 0.9 version onwards.