Longhorn Storage Solution for Kubernetes Cluster

Btech Engineering
btech-engineering
Published in
3 min readJan 27, 2023

Add new disk to Longhorn Cluster

Longhorn + Kubernetes

Intro

In the previous article, we discussed installing longhorn on a Kubernetes cluster. In this article, we will discuss adding new disk to longhorn cluster. Before we start, make sure we have a kubernetes cluster with longhorn installed.

we already have a kubernetes cluster with longhorn installed with 3nodes specification.

Step-by-step

Add Disk or volume to VM Kubernetes workers. Because we have VMs on top of OpenStack Cloud, we will add Volumes OpenStack

After add Volumes, we must mount new disk.

## Run in worker node
fdisk /dev/vd*
mkfs.ext4 /dev/vd*
mkdir /mnt/disk*
mount /dev/vd* /mnt/disk*

Add disk from longhorn UI

  • Klik Node
  • Klik Dropdown Menu, Edit Node and Disk
  • Then Click add Disk
  • Fill Name, Path, and Storage Reserved (if needed), and Change scheduling to Enable for activated the disk
  • Click Save & Verify

List pod

List pod initial deployment longhorn with 3 workers

Resources

Creating storage class

vim storageclass.yaml
...
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: longhorn
provisioner: driver.longhorn.io
allowVolumeExpansion: true
parameters:
numberOfReplicas: "3"
staleReplicaTimeout: "2880" # 48 hours in minutes
fromBackup: ""
...
kubectl apply -f storageclass.yaml
kubectl get sc

Verify

  • List Volume
  • List Replica

Next Up

In the next article, we will discuss the ranchers or RKE .

Based on Documentation, Razzaaq Arditian Research Team Btech

Our Tagline

#ContinuousLearning

Reference

https://longhorn.io/

--

--

Btech Engineering
btech-engineering

Our mission is continuous learning and remember together is better.