Create an OpenEBS StorageClass and Set It as the Default
Scenario
OpenEBS is installed on the cluster. You need to create a custom StorageClass that uses OpenEBS local provisioning and make it the default StorageClass for the cluster.
The existing default StorageClass local-path must no longer be marked as default — a cluster should have only one default StorageClass.
The manifest file must be saved at:
/home/laborant/openebs-local-sc.yaml
Task
- Create a StorageClass named
openebs-localwith the following configuration and save the manifest at/home/laborant/openebs-local-sc.yaml:Field Value provisioneropenebs.io/localvolumeBindingModeWaitForFirstConsumerreclaimPolicyDeleteallowVolumeExpansiontrue - After applying the manifest, make
openebs-localthe new default StorageClass and remove the default annotation fromlocal-path.
Hint 1
Use kubectl annotate storageclass to set or remove the storageclass.kubernetes.io/is-default-class annotation.
Alternatively, use kubectl patch storageclass to add or update the annotation via a merge patch, which is useful for automation or scripting.
To set as default use storageclass.kubernetes.io/is-default-class=true and to remove use storageclass.kubernetes.io/is-default-class-.
See the official docs: