Chapter 5. Post-update configuration changes

In some cases, additional configuration steps are required after an update to ensure that all features work as expected.

5.1. Post-update configuration for clusters backed by local storage

In Red Hat OpenShift Container Platform 4.6 and onward, the Local Storage operator provides new custom resource types for managing local storage:

  • LocalVolumeDiscovery
  • LocalVolumeSet

These resource types are not automatically handled as part of an update from earlier versions, and must be created manually.

5.1.1. Creating a LocalVolumeDiscovery custom resource using the command line

Create a LocalVolumeDiscovery custom resource to ensure that the device management user interface can discover the state of local devices and provide information about devices that are available on cluster nodes.

Prerequisites

  • Administrative access to the OpenShift Container Platform cluster.

Procedure

  1. Change into the project that has Local Storage operator installed.

    $ oc project local-storage-project

    Replace local-storage-project with the name of your Local Storage project.

    In version 4.5 and earlier the name of the default local storage project is local-storage. In version 4.6 and later, the name of the default local storage project is openshift-local-storage.

  2. Define the LocalVolumeDiscovery custom resource.

    For example, define the following in a local-volume-discovery.yaml file.

    apiVersion: local.storage.openshift.io/v1alpha1
    kind: LocalVolumeDiscovery
    metadata:
      name: auto-discover-devices
    spec:
      nodeSelector:
        nodeSelectorTerms:
          - matchExpressions:
              - key: kubernetes.io/hostname
                operator: In
                values:
                  - worker1.example.com
                  - worker2.example.com
                  - worker3.example.com
  3. Create the LocalVolumeDiscovery custom resource.

    $ oc create -f local-volume-discovery.yaml

Verification steps

  1. Log in to the OpenShift web console.
  2. Click ComputeNode and click on the name of the node.
  3. Click the Disks tab and check that you can see the devices available on that node.

5.1.2. Creating a LocalVolumeSet custom resource using the command line

Create a LocalVolumeSet custom resource to automatically provision certain storage devices as persistent volumes based on criteria that you specify. Persistent volumes are created for any devices that match the deviceInclusionSpec criteria on any node that matches the nodeSelector criteria.

Prerequisites

  • Administrative access to the OpenShift Container Platform cluster.

Procedure

  1. Define a LocalVolumeSet custom resource in a local-volume-set.yaml file.

    apiVersion: local.storage.openshift.io/v1alpha1
    kind: LocalVolumeSet
    metadata:
      name: localblock
    spec:
      nodeSelector:
        nodeSelectorTerms:
          - matchExpressions:
              - key: kubernetes.io/hostname
                operator: In
                values:
                  - worker1.example.com
                  - worker2.example.com
                  - worker3.example.com
      storageClassName: localblock
      volumeMode: Block
      maxDeviceCount: 10 # optional, limit devices provisioned per node
      deviceInclusionSpec:
        deviceTypes: # list of types to allow
          - disk
          - part # omit this to use only whole devices
        deviceMechanicalProperty:
          - NonRotational
        minSize: 100Gi # optional, minimum size of device to allow
        maxSize: 100Ti # optional, maximum size of device to allow
        models: # (optional) list of models to allow
          - SAMSUNG
          - Crucial_CT525MX3
        vendors: # (optional) list of device vendors to allow
          - ATA
          - ST2000LM

    The above definition selects whole disks or partitions on specific models of non-rotational devices that are between 100 GB and 100 TB in size, provided by specific vendors, from the worker1, worker2 and worker3 nodes. The localblock storage class is created and persistent volumes are provisioned from discovered devices.

    Important

    Select an appropriate value for minSize to ensure system partitions are not selected.

  2. Create the LocalVolumeSet.

    $ oc create -f local-volume-set.yaml

Verification steps

  1. Use the following command to track provisioning of persistent volumes for devices that match the deviceInclusionSpec. It can take a few minutes to provision persistent volumes.

    $ oc describe localvolumeset localblock
    [...]
    Status:
      Conditions:
        Last Transition Time:          2020-11-17T05:03:32Z
        Message:                       DiskMaker: Available, LocalProvisioner: Available
        Status:                        True
        Type:                          DaemonSetsAvailable
        Last Transition Time:          2020-11-17T05:03:34Z
        Message:                       Operator reconciled successfully.
        Status:                        True
        Type:                          Available
      Observed Generation:             1
      Total Provisioned Device Count: 4
    Events:
    Type    Reason      Age          From                Message
    ----    ------      ----         ----                -------
    Normal  Discovered  2m30s (x4    localvolumeset-     ip-10-0-147-124.us-east-
            NewDevice   over 2m30s)  symlink-controller  2.compute.internal -
                                                         found possible matching
                                                         disk, waiting 1m to claim
    Normal  FoundMatch  89s (x4      localvolumeset-     ip-10-0-147-124.us-east-
            ingDisk     over 89s)    symlink-controller  2.compute.internal -
                                                         symlinking matching disk
  2. Verify the state of the provisioned persistent volumes.

    $ oc get pv
                         ACCESS   RECLAIM             STORAGE
    NAME       CAPACITY  MODES    POLICY   STATUS     CLASS       AGE
    local-pv-  500Gi     RWO      Delete   Available  localblock  7m48s
    3584969f
    local-pv-  500Gi     RWO      Delete   Available  localblock  7m48s
    3aee84fa
    local-pv-  500Gi     RWO      Delete   Available  localblock  7m48s
    644d09ac
    local-pv-  500Gi     RWO      Delete   Available  localblock  7m48s
    c73cee1

5.1.3. Adding annotations

Use this procedure to add annotations to storage cluster to enable replacing of failed storage devices through the user interface when you upgraded to OpenShift Container Storage 4.6 from a previous version.

Procedure

  1. Log in to OpenShift Container Platform Web Console.
  2. Click HomeSearch.
  3. Search for StorageCluster in Resources and click on it.
  4. Beside ocs-storagecluster, click Action menu (⋮)Edit annotations.
  5. Add cluster.ocs.openshift.io/local-devices=true and true for KEY and VALUE respectively.
  6. Click Save.