Longhorn

Modified on Tue, 26 Nov at 12:33 PM

What is Longhorn?

Longhorn is an open-source distributed block storage system built for Kubernetes. It runs as containers and microservices, ensuring reliability and high availability across nodes. Each volume is synchronously replicated across multiple nodes for fault tolerance.

Key Features:

  • Distributed block storage
  • Snapshots and backups
  • Cross-cluster disaster recovery
  • You can download Longhorn from the official repository:
  • Longhorn Original Documentation 

Note: If using k3s, disable the default local storage provisioning with the flag --disable=local-storage in the k3s service or command.


Installing or Upgrading Longhorn

Step 1: Fetch the Configuration files

Download the file longhorn.values.yml. It contains configuration values to start Longhorn. It is already filled with the values recommended by Collab.

Download files: sc.longhorn-duo.yml, sc.longhorn-duo-retain.yml, sc.longhorn-single.yml -> These are configurations to create usefull disk types.

Open a CommandLine or PowerShell in the folder containing all downloaded files.



Step 3: Install or Upgrade Longhorn

Run the following commands:


helm repo add longhorn https://charts.longhorn.io

helm repo update longhorn

helm upgrade --install longhorn longhorn/longhorn --version 1.6.2 -n longhorn --create-namespace -f longhorn.values.yml"


Verifying Deployment

Check if all pods are running correctly:


kubectl -n longhorn get pod


Expected Output:


NAME                                                READY   STATUS    RESTARTS   AGE

longhorn-ui-b7c844b49-w25g5                         1/1     Running   0          2m41s

longhorn-manager-pzgsp                              1/1     Running   0          2m41s

longhorn-driver-deployer-6bd59c9f76-lqczw           1/1     Running   0          2m41s

longhorn-csi-plugin-mbwqz                           2/2     Running   0          100s

csi-snapshotter-588457fcdf-22bqp                    1/1     Running   0          100s

csi-snapshotter-588457fcdf-2wd6g                    1/1     Running   0          100s

csi-provisioner-869bdc4b79-mzrwf                    1/1     Running   0          101s

csi-provisioner-869bdc4b79-klgfm                    1/1     Running   0          101s

csi-resizer-6d8cf5f99f-fd2ck                        1/1     Running   0          101s

csi-provisioner-869bdc4b79-j46rx                    1/1     Running   0          101s

csi-snapshotter-588457fcdf-bvjdt                    1/1     Running   0          100s

csi-resizer-6d8cf5f99f-68cw7                        1/1     Running   0          101s

csi-attacher-7bf4b7f996-df8v6                       1/1     Running   0          101s

csi-attacher-7bf4b7f996-g9cwc                       1/1     Running   0          101s

csi-attacher-7bf4b7f996-8l9sw                       1/1     Running   0          101s

csi-resizer-6d8cf5f99f-smdjw                        1/1     Running   0          101s

instance-manager-b34d5db1fe1e2d52bcfb308be3166cfc   1/1     Running   0          114s

engine-image-ei-df38d2e5-cv6nc                      1/1     Running   0          114s



Deployments like csi-attacher or csi-provisioner will be duplicated across nodes in multi-node clusters.


Setting Up Custom Storage Classes

Run the following commnads to create the Volume.StorageTypes required by Collab:


Two Replicas, Delete Reclaim Policy:


kubectl apply -f sc.longhorn-duo.yml



Two Replicas, Retain Reclaim Policy:


kubectl apply -f sc.longhorn-duo-retain.yml



One Replica, Delete Policy (Default):


kubectl apply -f sc.longhorn-single.yml


Verify Storage Classes:

After applying, run:


kubectl get sc


Expected Output:


NAME                        PROVISIONER          RECLAIMPOLICY   VOLUMEBINDINGMODE   ALLOWVOLUMEEXPANSION   AGE

longhorn                    driver.longhorn.io   Retain          Immediate           true                   146d

longhorn-duo                driver.longhorn.io   Delete          Immediate           true                   137d

longhorn-duo-retain         driver.longhorn.io   Retain          Immediate           true                   115d

longhorn-single (default)   driver.longhorn.io   Delete          Immediate           true                   137d





Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article