1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/persistent-storage-csi-cinder-storage-class.adoc
2025-08-12 09:20:08 +00:00

86 lines
3.0 KiB
Plaintext

// Module included in the following assemblies:
//
// * storage/container_storage_interface/persistent-storage-csi-cinder.adoc
:_mod-docs-content-type: PROCEDURE
[id="persistent-storage-csi-cinder_{context}"]
= Making OpenStack Cinder CSI the default storage class
The OpenStack Cinder CSI driver uses the `cinder.csi.openstack.org` parameter key to support dynamic provisioning.
To enable OpenStack Cinder CSI provisioning in {product-title}, it is recommended that you overwrite the default in-tree storage class with `standard-csi`. Alternatively, you can create the persistent volume claim (PVC) and specify the storage class as "standard-csi".
In {product-title}, the default storage class references the in-tree Cinder driver. However, with CSI automatic migration enabled, volumes created using the default storage class actually use the CSI driver.
.Procedure
Use the following steps to apply the `standard-csi` storage class by overwriting the default in-tree storage class.
. List the storage class:
+
[source,terminal]
--
$ oc get storageclass
--
+
[source,terminal]
.Example output
--
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
standard(default) cinder.csi.openstack.org Delete WaitForFirstConsumer true 46h
standard-csi kubernetes.io/cinder Delete WaitForFirstConsumer true 46h
--
. Change the value of the annotation `storageclass.kubernetes.io/is-default-class` to `false` for the default storage class, as shown in the following example:
+
[source,terminal]
--
$ oc patch storageclass standard -p '{"metadata": {"annotations": {"storageclass.kubernetes.io/is-default-class": "false"}}}'
--
. Make another storage class the default by adding or modifying the annotation as `storageclass.kubernetes.io/is-default-class=true`.
+
[source,terminal]
--
$ oc patch storageclass standard-csi -p '{"metadata": {"annotations": {"storageclass.kubernetes.io/is-default-class": "true"}}}'
--
. Verify that the PVC is now referencing the CSI storage class by default:
+
[source,terminal]
--
$ oc get storageclass
--
+
[source,terminal]
.Example output
--
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
standard kubernetes.io/cinder Delete WaitForFirstConsumer true 46h
standard-csi(default) cinder.csi.openstack.org Delete WaitForFirstConsumer true 46h
--
. Optional: You can define a new PVC without having to specify the storage class:
+
[source,yaml]
--
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: cinder-claim
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
--
+
A PVC that does not specify a specific storage class is automatically provisioned by using the default storage class.
+
. Optional: After the new file has been configured, create it in your cluster:
+
[source,terminal]
--
$ oc create -f cinder-claim.yaml
--