Chapter 6. Post-update configuration changes for clusters backed by local storage
In clusters backed by local storage, additional configuration steps are required after an update to ensure that all features work as expected. 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.
If you had already created these resources after upgrading from 4.5 to 4.6, then you do not need to create them after upgrading from 4.6 to 4.7.
6.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
Identify the namespace where OpenShift local storage operator is installed and assign it to
local_storage_project
variable:$ local_storage_project=$(oc get csv --all-namespaces | awk '{print $1}' | grep local)
For example:
$ local_storage_project=$(oc get csv --all-namespaces | awk '{print $1}' | grep local) echo $local_storage_project openshift-local-storage
Change into the project that has the Local Storage Operator installed.
$ oc project $local_storage_project
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
Create the
LocalVolumeDiscovery
custom resource.$ oc create -f local-volume-discovery.yaml
Verification steps
- Log in to the OpenShift web console.
-
Click Compute
Node and click on the name of the node. - Click the Disks tab and check that you can see the devices available on that node.
6.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
Define a
LocalVolumeSet
custom resource in alocal-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
andworker3
nodes. Thelocalblock
storage class is created and persistent volumes are provisioned from discovered devices.ImportantSelect an appropriate value for
minSize
to ensure system partitions are not selected.Create the
LocalVolumeSet
.$ oc create -f local-volume-set.yaml
Verification steps
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
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
6.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.7 from a previous version.
Procedure
- Log in to OpenShift Container Platform Web Console.
-
Click Home
Search. - Search for StorageCluster in Resources and click on it.
-
Beside
ocs-storagecluster
, click Action menu (⋮)Edit annotations. -
Add
cluster.ocs.openshift.io/local-devices
andtrue
for KEY and VALUE respectively. - Click Save.