Automatic Discovery and Provisioning of Local Persistent Volume (PV) in OpenShift - Part 1
Overview
Local persistent volumes in OpenShift are needed for applications such as databases, prometheus, Elasticsearch etc. who want to use local storage for performance. Though we can provision local volumes by manually creating LocalVolume CR and defining the nodes and paths to the local volumes but manually identifying/defining the nodes and paths to the local volumes becomes a time consuming Job especially when the number of nodes and locally attached disks are high.
Local Storage Operators (LSO) can automate local disks discovery and provisioning of OpenShift PVs. With this feature, you can also simplify installation when dynamic provisioning is not available during deployment, such as with Bare Metal, VMware, or AWS store instances with attached devices.
This feature is currently Tech Preview in RHOCP 4.11 version. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process. Red Hat does not recommend using them in production. Please refer to the details here.
Scenario
In this blog, I will use LSO feature to automatically discover locally attached storage devices and provision Persistent Volumes (PV) on them. To demonstrate this feature, I am using Red Hat OpenShift cluster 4.10 with 3 Masters and 2 Workers nodes/VMs.
Environment
There are 3 additional raw/local disks (vd{b,c,d}) on each worker node (worker1 & worker2), each disk is of size 20GiB. These raw disks attached on nodes will be automatically discovered and provisioned as Local Volumes (PV) by LSO.
Steps:-
1. Install LSO (Local Storage Operator) from OperatorHub
2. Auto Discovering Local Disks
Before discovering disks, let us take a look at the storage device list for each worker node.?We can see that as of now, there is no disk showing on worker nodes because we have not started discovery yet.
2.1. Selecting All or Desired nodes for Disks Discovery
Let us select desired worker nodes where we want to discover disks:-
Now let us check the storage device list for each Worker node. We can see that devices vd{b,c,d} have been successfully discovered on chosen worker nodes.
3. Auto Provision OpenShift PV
Next, let us take a look at existing storage classes and PVs. Currently no storage class and PVs exists. Now we will create a LocalVolumeSets resource to provision desired PVs as follows:-
If StorageClass Name is empty then it uses the same name as LocalVolumeSet. Select the worker nodes where Disks were discovered.
In Disk Type we can choose among options - All, SSD/NVMe and HDD. In our scenario, as we have all HDD raw virtual?disks of the same type and size attached on worker nodes?and we want to configure all disks as?Local Volumes so?we will choose All. Keep remaining options as default.
Finally, It’s time to check for PVs. We can see a total 6 PVs autoprovisioned, (each disk as single PV) and StorageClass --> localblock has been created automatically and PVs are Available for consumption using localblock storage class in OpenShift.
Conclusion
In this blog post, we saw LSO can automatically discover Local disks and quickly provision OpenShift PVs on them. StorageClass is created automatically and readily available for Persistent Volumes consumption. This also simplifies overall Local PVs provisioning process.
What's Next
In next blog, we will create Persistent Volume Claim (PVC) and mount auto-provisioned PVs inside Application Pod. We will also add/attach new disks on Worker nodes and see LSO automatically discover newely attached disks, autoprovison PVs on them and make them readily available for consumption using StorageClass.
Senior Solution Architect.
2 年Very informative ! Thank you !!
Transformation Coach | Leadership Development | Creating Safe Spaces for Personal & Professional Development | Human-Centric Leadership | Storytelling for Leadership Development | Championing Self-Awareness in Leadership
2 年Hi Anuvrat! Thank you for writing this insightful article. It gave me a peek into your world and the great work you do for your customers. Loved the structure - you've made it so easy to absorb the information. Can't wait to read the next article on Persistent Volume Claim and the process of mounting PVs in the application pod.
Hybrid Cloud & Ansible Automation Expert | Consulting Practice Lead | Openshift | Multicloud | Ceph | RHCE,RHCSS,RHCA
2 年awesome..!!