Automatic Discovery and Provisioning of Local Persistent Volume (PV) in OpenShift - Part 2

Automatic Discovery and Provisioning of Local Persistent Volume (PV) in OpenShift - Part 2

Overview

In Part 1, we saw that Local Storage Operator (LSO) simplifies the overall Local PV provisioning process by automatically discovering Local disks and auto-provisioning PVs on them. StorageClass is created automatically and readily available for Persistent Volume consumption inside pod. This is still Tech Preview feature.

Scenario

In this blog, I will cover following scenarios:-

  • In first scenario, we will see how to dynamically consume Local PVs (auto-provisioned by LSO in Part 1) inside application pod. To demonstrate this, I will use PostgreSQL database application already deployed in current OpenShift setup. PostgreSQL deployment is using OpenShift DeploymentConfig object named "postgresql" and in order to consume Local PV, we will update this "deploymentconfig/postgresql" object by adding Persistent Volume Claim (PVC) using StorageClass (localblock) and specifying directory for mounting Local PV inside postgresql pod.
  • In second scenario, I will add/attach new local disks on OpenShift worker nodes and we will see that LSO can automatically discover newly added/attached disks and auto-provisions OpenShift Local PVs on them.

Environment

In Part 1, LSO created the following Local PVs and StorageClass (localblock) automatically. We will start from there.

No alt text provided for this image

Now, let us mount Local PV for PostgreSQL database application pod.

Steps

Scenario 1

Mounting Local PVs for Applications

Initially postgresql pod is using an empty directory for its storage and there is no mount directory "/var/lib/pgsql/data" & PVC exists.

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Let us update OpenShift deploymentconfig/postgresql object and add Persistent Volume Claim (PVC) using localblock StorageClass. We want to mount Local PV on /var/lib/pgsql/data directory inside postgresql pod.

No alt text provided for this image

PVC using StorageClass "localblock" has been bound successfully to Local PV and volume also mounted inside the /var/lib/pgsql/data directory of postgresql pod.

No alt text provided for this image
No alt text provided for this image

Scenario 2

LSO automated discovery and Local PV provisioning for newly attached/added storage disks

First, let us add a new disk on the worker node. Prior doing that, let us see current list of disks present on worker nodes, as shown below, only vd{b,c,d} disks are present.

No alt text provided for this image
No alt text provided for this image

Check the current number of PVs. we can see 6 PV as expected against total 6 disks attached on both worker nodes (3 disks on each worker node)

No alt text provided for this image

Let us add 1 new disk on worker1 node and check for its automatic discovery and Local PV provisioning by LSO.

No alt text provided for this image
No alt text provided for this image

We can see storage Disk vde automatically discovered on worker1 node.

No alt text provided for this image

we can see Local PV on newly auto-discovered disk (vde) has been provisioned automatically by LSO.

No alt text provided for this image

We can see device name vde provisioned by LSO and appearing in Annotations key.

No alt text provided for this image

Conclusion

In this part, we saw that OpenShift LSO make it easier for containerized applications to consume Local storage PVs dynamically/automatically using Local StorageClass. We also saw that OpenShift LSO can automatically discover newly added/attached Local disks on Worker nodes and auto-provision Local PVs on them and thus simplifying Day-2 IT Operations as well.

Please feel free to play with OpenShift Local Storage Operator and share your feedback!! For more details, please refer following links:-


Chintamani Joshi

Architecture & Technical Sales Leader at Red Hat

2 年

informative. Thanks! Anuvrat

回复
Cheriyan Mathew

Manager-Solution Architecture at Red Hat

2 年

Very informative reading. Thanks Anuvrat

回复
Yatin Bhardwaj

General Manager - AI platform solution (NVIDIA/AMD), Cloud Engineering, Edge Computing, Openshift, Openstack.

2 年

That’s amazing Anuvrat ??

回复
Rajveer Singh

Hybrid Cloud & Ansible Automation Expert | Consulting Practice Lead | Openshift | Multicloud | Ceph | RHCE,RHCSS,RHCA

2 年

Thanks for completing 2nd part for LSO Operator... Great information, very helpful..!!

回复

要查看或添加评论,请登录

Anuvrat Sharma的更多文章