1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-07 00:48:01 +01:00
Files
openshift-docs/modules/virt-creating-storage-class.adoc
Lavanya a152f3d640 This is a combination of 3 commits on Aug 12.
source and output formatting

add source terminal tags

source,terminal tags

peer review
2020-08-17 17:05:59 +00:00

54 lines
1.6 KiB
Plaintext

// Module included in the following assemblies:
//
// * virt/virtual_machines/virtual_disks/virt-configuring-local-storage-for-vms.adoc
[id="virt-creating-storage-class_{context}"]
= Creating a StorageClass object
When you create a StorageClass object, you set parameters that affect the
dynamic provisioning of PersistentVolumes (PVs) that belong to that storage class. +
[NOTE]
====
You cannot update a StorageClass object's parameters after you create it.
====
.Procedure
. Create a YAML file for defining the storage class. For example:
+
[source,terminal]
----
$ touch storageclass.yaml
----
. Edit the file. For example:
+
[source,yaml]
----
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: hostpath-provisioner <1>
provisioner: kubevirt.io/hostpath-provisioner
reclaimPolicy: Delete <2>
volumeBindingMode: WaitForFirstConsumer <3>
----
<1> You can optionally rename the storage class by changing this value.
<2> The two possible `reclaimPolicy` values are `Delete` and `Retain`. If you
do not specify a value, the storage class defaults to `Delete`.
<3> The `volumeBindingMode` value determines when dynamic provisioning and volume
binding occur. Specify `WaitForFirstConsumer` to delay the binding and provisioning
of a PV until after a Pod that uses the PersistentVolumeClaim (PVC)
is created. This ensures that the PV meets the Pod's scheduling requirements.
. Create the StorageClass object:
+
[source,terminal]
----
$ oc create -f storageclass.yaml
----
.Additional information
* link:https://kubernetes.io/docs/concepts/storage/storage-classes/[Storage Classes]