Longhorn Storage Solution for Kubernetes Cluster
How to Setup LongHorn with Rancher UI
Intro
In the previous article, we discussed using cinder as a Kubernetes storage backend using the CSI Driver. In this article, we try to show how to setup longhorn as a Kubernetes storage backend.
What Is Longhorn?
Longhorn is a dependable, efficient, and robust distributed storage system for Kubernetes, it utilizes containers and microservices for distributed block storage. It assigns a specific storage controller for every block volume and replicates the volume across multiple nodes synchronously. Kubernetes is utilized to orchestrate the storage controller and replicas.
Feature
- Use Longhorn volumes as persistent storage for the distributed stateful applications
- Use Kubernetes volumes with or without a cloud provider
- Replicate block storage across multiple nodes and data centers
- Store backup data in external storage such as NFS or AWS S3
- Create cross-cluster disaster recovery volumes
- Scheduling snapshots and backup of a volume
- Restore volumes from backup
- Upgrade Longhorn without disrupting persistent volumes.
Longhorn data flow
Installation
Requirements
- A container runtime compatible with Kubernetes (Docker v1.13+, containerd v1.3.7+, etc.)
- Kubernetes version >= v1.18 and <= v1.24
Pre-Installation
- Install open-iscsi and NFSv4 client on all worker nodes
apt-get install open-iscsi
apt-get install nfs-common
- Verify cluster information with script
apt-get install jq
curl -sSfL https://raw.githubusercontent.com/longhorn/longhorn/v1.3.2/scripts/environment_check.sh | bash
Install Longhorn
For installation longhorn we can use 2 types, direct from the rancher dashboard when we use Rancher as Kubernetes management & RKE or we can use helm installation. In this scenario we will use GUI Installation method & Helm Installation.
Install as a Rancher Apps & Marketplace (GUI Installation)
- Klik cluster will be installed a Longhorn
- Klik Tab Apps -> Charts
- Search
longhorn
apps
- Click Install
- Optional: Select the project where you want to install Longhorn.
- Click Next. Longhorn will be installed in the longhorn-system namespace
- Click the Longhorn App Icon to navigate to the Longhorn dashboard
You can monitor your storage from Longhorn dashboard such as add new node, extend volume and etc.
Helm Installation
- Add Chart
helm repo add longhorn https://charts.longhorn.io
helm repo update
- Helm Install
# helm2
helm install longhorn/longhorn --name longhorn --namespace longhorn-system --version 1.3.2
# helm3
helm install longhorn longhorn/longhorn --namespace longhorn-system --create-namespace --version 1.3.2
- Verify
kubectl -n longhorn-system get pod
- To enable access to the Longhorn UI, you will need to set up an Ingress controller
- Accessing UI longhorn
Next Up
In the next article, we will show about managing longhorn backend storage such as adding a disk, or we can discuss the ranchers or RKE first.
Based on Documentation, Razzaaq Arditian Research Team Btech