|
| 1 | +// This module is included in the following assemblies: |
| 2 | +// |
| 3 | +// storage/persistent_storage/persistent_storage_local/persistent-storage-using-lvms.adoc |
| 4 | + |
| 5 | +:_content-type: PROCEDURE |
| 6 | +[id="adding-a-storage-class_{context}"] |
| 7 | += Adding a storage class |
| 8 | + |
| 9 | +You can add a storage class to an {product-title} cluster. A storage class describes a class of storage in the cluster and how the cluster dynamically provisions the persistent volumes (PVs) when the user specifies the storage class. A storage class describes the type of device classes, the quality-of-service level, the filesystem type, and other details. |
| 10 | + |
| 11 | +.Procedure |
| 12 | + |
| 13 | +. Create a YAML file: |
| 14 | ++ |
| 15 | +[source,yaml] |
| 16 | +---- |
| 17 | +apiVersion: storage.k8s.io/v1 |
| 18 | +kind: StorageClass |
| 19 | +metadata: |
| 20 | + name: lvm-storageclass |
| 21 | +parameters: |
| 22 | + csi.storage.k8s.io/fstype: ext4 |
| 23 | + topolvm.io/device-class: vg1 |
| 24 | +provisioner: topolvm.io |
| 25 | +reclaimPolicy: Delete |
| 26 | +allowVolumeExpansion: true |
| 27 | +volumeBindingMode: WaitForFirstConsumer |
| 28 | +---- |
| 29 | ++ |
| 30 | +Save the file by using a name similar to the storage class name. For example, `lvm-storageclass.yaml`. |
| 31 | + |
| 32 | +. Apply the YAML file by using the `oc` command: |
| 33 | ++ |
| 34 | +[source,terminal] |
| 35 | +---- |
| 36 | +$ oc apply -f <file_name> <1> |
| 37 | +---- |
| 38 | +<1> Replace `<file_name>` with the name of the YAML file. For example, `lvm-storageclass.yaml`. |
| 39 | ++ |
| 40 | +The cluster will create the storage class. |
| 41 | + |
| 42 | +. Verify that the cluster created the storage class by using the following command: |
| 43 | ++ |
| 44 | +[source,terminal] |
| 45 | +---- |
| 46 | +$ oc get storageclass <name> <1> |
| 47 | +---- |
| 48 | +<1> Replace `<name>` with the name of the storage class. For example, `lvm-storageclass`. |
| 49 | ++ |
| 50 | +.Example output |
| 51 | +[source,terminal,options="nowrap",role="white-space-pre"] |
| 52 | +---- |
| 53 | +NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE |
| 54 | +lvm-storageclass topolvm.io Delete WaitForFirstConsumer true 1s |
| 55 | +---- |
0 commit comments