$ oc get storageclass
You can provision and manage OpenStack Cinder storage in OKD using the OpenStack Cinder Container Storage Interface (CSI) Driver Operator and driver, which provide dynamic volume provisioning.
OKD is capable of provisioning persistent volumes (PVs) using the Container Storage Interface (CSI) driver for OpenStack Cinder.
Familiarity with persistent storage and configuring CSI volumes is recommended when working with a CSI Operator and driver. For more information, see "Understanding persistent storage" and "Configuring CSI volumes."
To create CSI-provisioned PVs that mount to OpenStack Cinder storage assets, OKD installs the OpenStack Cinder CSI Driver Operator and the OpenStack Cinder CSI driver in the openshift-cluster-csi-drivers namespace.
The OpenStack Cinder CSI Driver Operator provides a CSI storage class that you can use to create PVCs. You can disable this default storage class if needed (see "Managing the default storage class").
The OpenStack Cinder CSI driver enables you to create and mount OpenStack Cinder PVs.
|
OKD provides automatic migration for the Cinder in-tree volume plugin to its equivalent CSI driver. For more information, see "CSI automatic migration". |
|
OKD defaults to using the CSI plugin to provision Cinder storage. |
The Container Storage Interface (CSI) enables storage vendors to deliver plugins through a standard interface without modifying Kubernetes core code, replacing traditional embedded storage drivers.
CSI Operators give OKD users storage options, such as volume snapshots, that are not possible with in-tree volume plugins.
To use the OpenStack Cinder Container Storage Interface (CSI) driver for dynamic provisioning instead of the in-tree driver, change the default storage class from standard to standard-csi by updating storage class annotations.
The OpenStack Cinder CSI driver uses the cinder.csi.openstack.org parameter key to support dynamic provisioning.
To enable OpenStack Cinder CSI provisioning in OKD, 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 OKD, 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.
Use the following steps to apply the standard-csi storage class by overwriting the default in-tree storage class.
List the storage class by running the following command:
$ oc get storageclass
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:
$ 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.
$ 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:
$ oc get storageclass
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:
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:
$ oc create -f cinder-claim.yaml