Dedicated partition for application


I’m starting with Microk8s and also with Kubernetes, I have a cluster with 4 machines, one of the applications I want to run, needs the data to be replicated on all nodes to have redundancy.

I installed the mayastor plugin to do the replication, the question is how to do this configuration, I would like to create a separate partition based on lvm with an xfs file system on each server.

Has anyone already done this, if so would you be able to explain how this configuration is done?


Hi, paulohperes

Check the following steps carefully

Ensure that Microk8s is installed on all nodes.
Install Mayastor using the Mayastor Helm diagram. You can find the diagram in the Mayastor GitHub repository.
Make sure each node has a separate partition for storage.
Use LVM (Logical Volume Management) to create logical volumes on separate partitions of each node. This includes creating a physical volume (PV), volume group (VG) and logical volumes (LVs).

Once you have the logical volumes, format them with the XFS file system. You can use the mkfs.xfs command for this.
Configure Mayastor pools:

Configure Mayastor to use these XFS format partitions as the storage pool. You must define a StorageClass in Kubernetes to represent this storage.
Create PVs representing XFS and PVC partitions to request these volumes for your application.
Deploy your application to Kubernetes by referencing the PVCs you created. Make sure your application is configured to use these PVCs for redundancy.
Pay attention to the example below

# storage-class.yaml
kind: StorageClass
  name: mayastor-sc
# persistent-volume.yaml
apiVersion: v1
kind: PersistentVolume
  name: mayastor-pv
    storage: 10Gi
  volumeMode: Block
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: mayastor-sc
    volumeHandle: mayastor-volume-1 # Mayastor pool name
# persistent-volume-claim.yaml
apiVersion: v1
kind: PersistentVolumeClaim
  name: mayastor-pvc
    - ReadWriteOnce
      storage: 10Gi
  storageClassName: mayastor-sc


Make sure to customize the sizes, names and other parameters as per your requirement.
And finally, remember to refer to the Mayastor official documentation and Microk8s documentation for detailed and specific guidance.

I hope it was useful …

First, thank you for your response.

I read the documentation and there are still some points that are not clear to me.

For example, I created the volumes and created the pools, one on each network node (I have 4). In your example in PV, there is the association with the Mayastor pool name, there you are placing the volume of node 1, in this case as I have 4 network nodes, how do you ensure that what is on node 1 is replicated to the others us, I mean the files which application uses?

My disk pools:

g0004830@p-br-pr-cta-gt2-mk8s-01:~/mk8s$ microk8s kubectl -n mayastor get dsp
NAME                                      NODE                      STATUS   CAPACITY      USED   AVAILABLE
pool-p-br-pr-cta-gt2-mk8s-01-gitness-lv   p-br-pr-cta-gt2-mk8s-01   Online   21449670656   0      21449670656
pool-p-br-pr-cta-gt2-mk8s-02-gitness-lv   p-br-pr-cta-gt2-mk8s-02   Online   21449670656   0      21449670656
pool-p-br-pr-cta-gt2-mk8s-03-gitness-lv   p-br-pr-cta-gt2-mk8s-03   Online   21449670656   0      21449670656
pool-p-br-pr-cta-gt2-mk8s-04-gitness-lv   p-br-pr-cta-gt2-mk8s-04   Online   21449670656   0      21449670656

My storage class I created with 4 replicas.

g0004830@p-br-pr-cta-gt2-mk8s-01:~/mk8s$ microk8s kubectl -n mayastor describe mayastor-sc-gitness 
Name:            mayastor-sc-gitness
IsDefaultClass:  No

Provisioner:           io.openebs.csi-mayastor
Parameters:            fsType=xfs,repl=4
AllowVolumeExpansion:  <unset>
MountOptions:          <none>
ReclaimPolicy:         Delete
VolumeBindingMode:     Immediate
Events:                <none>