×

Overview

OKD is capable of provisioning persistent volumes (PVs) using the Container Storage Interface (CSI) driver for oVirt.

Familiarity with persistent storage and configuring CSI volumes is recommended when working with a Container Storage Interface (CSI) Operator and driver.

To create CSI-provisioned PVs that mount to oVirt storage assets, OKD installs the oVirt CSI Driver Operator and the oVirt CSI driver by default in the openshift-cluster-csi-drivers namespace.

  • The oVirt CSI Driver Operator provides a default StorageClass object that you can use to create Persistent Volume Claims (PVCs).

  • The oVirt CSI driver enables you to create and mount oVirt PVs.

About CSI

Storage vendors have traditionally provided storage drivers as part of Kubernetes. With the implementation of the Container Storage Interface (CSI), third-party providers can instead deliver storage plugins using a standard interface without ever having to change the core Kubernetes code.

CSI Operators give OKD users storage options, such as volume snapshots, that are not possible with in-tree volume plugins.

The oVirt CSI driver does not support snapshots.

oVirt CSI driver storage class

OKD creates a default object of type StorageClass named ovirt-csi-sc which is used for creating dynamically provisioned persistent volumes.

To create additional storage classes for different configurations, create and save a file with the StorageClass object described by the following sample YAML:

ovirt-storageclass.yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: <storage_class_name>  (1)
  annotations:
    storageclass.kubernetes.io/is-default-class: "<boolean>"  (2)
provisioner: csi.ovirt.org
allowVolumeExpansion: <boolean> (3)
reclaimPolicy: Delete (4)
volumeBindingMode: Immediate (5)
parameters:
  storageDomainName: <rhv-storage-domain-name> (6)
  thinProvisioning: "<boolean>"  (7)
  csi.storage.k8s.io/fstype: <file_system_type> (8)
1 Name of the storage class.
2 Set to false if the storage class is the default storage class in the cluster. If set to true, the existing default storage class must be edited and set to false.
3 true enables dynamic volume expansion, false prevents it. true is recommended.
4 Dynamically provisioned persistent volumes of this storage class are created with this reclaim policy. This default policy is Delete.
5 Indicates how to provision and bind PersistentVolumeClaims. When not set, VolumeBindingImmediate is used. This field is only applied by servers that enable the VolumeScheduling feature.
6 The oVirt storage domain name to use.
7 If true, the disk is thin provisioned. If false, the disk is preallocated. Thin provisioning is recommended.
8 Optional: File system type to be created. Possible values: ext4 (default) or xfs.

Creating a persistent volume on RHV

When you create a PersistentVolumeClaim (PVC) object, OKD provisions a new persistent volume (PV) and creates a PersistentVolume object.

Prerequisites
  • You are logged in to a running OKD cluster.

  • You provided the correct oVirt credentials in ovirt-credentials secret.

  • You have installed the oVirt CSI driver.

  • You have defined at least one storage class.

Procedure
  • If you are using the web console to dynamically create a persistent volume on oVirt:

    1. In the OKD console, click StoragePersistent Volume Claims.

    2. In the persistent volume claims overview, click Create Persistent Volume Claim.

    3. Define the required options on the resulting page.

    4. Select the appropriate StorageClass object, which is ovirt-csi-sc by default.

    5. Enter a unique name for the storage claim.

    6. Select the access mode. Currently, RWO (ReadWriteOnce) is the only supported access mode.

    7. Define the size of the storage claim.

    8. Select the Volume Mode:

      Filesystem: Mounted into pods as a directory. This mode is the default.

      Block: Block device, without any file system on it

    9. Click Create to create the PersistentVolumeClaim object and generate a PersistentVolume object.

  • If you are using the command-line interface (CLI) to dynamically create a oVirt CSI volume:

    1. Create and save a file with the PersistentVolumeClaim object described by the following sample YAML:

      pvc-ovirt.yaml
      apiVersion: v1
      kind: PersistentVolumeClaim
      metadata:
        name: pvc-ovirt
      spec:
        storageClassName: ovirt-csi-sc (1)
        accessModes:
          - ReadWriteOnce
        resources:
          requests:
            storage: <volume size>  (2)
        volumeMode: <volume mode> (3)
      1 Name of the required storage class.
      2 Volume size in GiB.
      3 Supported options:
      • Filesystem: Mounted into pods as a directory. This mode is the default.

      • Block: Block device, without any file system on it.

    2. Create the object you saved in the previous step by running the following command:

      $ oc create -f pvc-ovirt.yaml
    3. To verify that the volume was created and is ready, run the following command:

      $ oc get pvc pvc-ovirt

      The pvc-ovirt shows that it is Bound.