Press "Enter" to skip to content

Installing Longhorn Storage Controller

bist 0

Longhorn is another awesome open-source project from Rancher Labs which provides a distributed block storage for your Kubernetes cluster. It also comes with a pre-installed dashboard which helps you with settings, backup, and monitoring. We can easily install longhorn using helm:

# add the longhorn helm repository
helm repo add longhorn https://charts.longhorn.io
# update helm repos
helm repo update
# create the namespace
kubectl create namespace longhorn-system
# install longhorn
helm install longhorn longhorn/longhorn --namespace longhorn-system

Check if everything went smoothly:

# check everything went smooth
kubectl -n longhorn-system get pod

You should see something like this:

NAME                                        READY   STATUS 
longhorn-ui-6fb889895f-klgs7 1/1 Running
instance-manager-e-20feb18d 1/1 Running
instance-manager-r-2d587ad2 1/1 Running
engine-image-ei-ee18f965-vrjk8 1/1 Running
longhorn-manager-qg7fz 1/1 Running
longhorn-driver-deployer-6756bb8fd6-wq757 1/1 Running
csi-provisioner-57d6dbf5f4-jn9rr 1/1 Running
csi-provisioner-57d6dbf5f4-5d67p 1/1 Running
longhorn-csi-plugin-z4z5c 2/2 Running
csi-attacher-5b4745c5f7-z9zqj 1/1 Running
csi-attacher-5b4745c5f7-hdvxj 1/1 Running
csi-provisioner-57d6dbf5f4-zt8jc 1/1 Running
csi-resizer-75ff56bc48-clx4p 1/1 Running
csi-resizer-75ff56bc48-qcq22 1/1 Running
csi-attacher-5b4745c5f7-q276d 1/1 Running
csi-resizer-75ff56bc48-spmt2 1/1 Running

Now, you should be able to access longhorn UI to access its configuration:

# check out the longhorn service
kubectl -n longhorn-system get svc
# forward the port to check the configuration
kubectl port-forward -n longhorn-system svc/longhorn-frontend 8002:80

You should now be able to open the longhorn dashboard from “http://localhost:8002”. Add any available disks you have on any VM in the cluster. If only 1 node is available in your k3s cluster, you will need to enable Replica Node Level Soft Anti-Afinity so that it will allow placing block backups on the same node (by default longhorn keeps 3 copies of each data block on different VMs, so that you won’t lose any data in case any data on a VM is lost).

Leave a Reply

Your email address will not be published. Required fields are marked *