In Kubernetes, when a PVC is created and uses HwameiStor as its local storage, HwameiStor will create two kinds of CR: LocalVolume
and LocalVolumeReplica
. Why create these two resources for one PV? Continue to read and you will find the answer.
LocalVolume
LocalVolume
is a CRD defined by HwameiStor. It is the volume that HwameiStor provides for users. Each LocalVolume
corresponds to a PersistentVolume
of Kubernetes. Both are volumes, but LocalVolume
stores HwameiStor-related information, while the other records information about Kubernetes itself and links it to LocalVolume
.
You can check details of LocalVolume
with this command:
# check status of local volume and volume replica
$ kubectl get lv # or localvolume
NAME POOL KIND REPLICAS CAPACITY ACCESSIBILITY STATE RESOURCE PUBLISHED AGE
pvc-996b05e8-80f2-4240-ace4-5f5f250310e2 LocalStorage_PoolHDD LVM 1 1073741824 k8s-node1 Ready -1 22m
Now that HwameiStor can use LocalVolume
to provide a volume, why do we still need LocalVolumeReplica
?
LocalVolumeReplica
LocalVolumeReplica
is another CRD defined by HwameiStor. It represents a replica of a volume.
In HwameiStor, LocalVolume
can specify one of its LocalVolumeReplica
as the active replica. As a volume, LocalVolume
can have many LocalVolumeReplica
as its replicas. The replica in active state will be mounted by applications and others will stand by as high available replicas.
You can check details of LocalVolumeReplica
with this command:
$ kubectl get lvr # or localvolumereplica
NAME KIND CAPACITY NODE STATE SYNCED DEVICE AGE
pvc-996b05e8-80f2-4240-ace4-5f5f250310e2-v5scm9 LVM 1073741824 k8s-node1 Ready true /dev/LocalStorage_PoolHDD/pvc-996b05e8-80f2-4240-ace4-5f5f250310e2 80s
LocalVolumeReplica
allows HwameiStor to support features like HA, migration, hot standby of volumes and fast recovery of Kubernetes applications, making it more competitive as a local storage tool.
Conclusion
LocalVolume
and LocalVolumeReplica
are common concepts in many storage products, but each product can have its own competitive and unique features based on these two concepts. A technical difficulty can be solved with different solutions, so these concepts are also suitable for different production scenarios.
We will provide more capabilities for more scenarios in future releases. Both users and developers are welcome to join us!