Skip to content

Longhorn installation on k3s

Longhorn is a highly available persistent storage for Kubernetes

Project page: https://longhorn.io

Requirements

  • k3s cluster
  • kubectl
  • helm
  • Longhorn installed on cluster

Installation

helm repo add longhorn https://charts.longhorn.io
helm repo update
helm install longhorn longhorn/longhorn --namespace longhorn --create-namespace

Make Longhorn a default storageclass:

kubectl patch storageclass local-path -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'

Restarting a node causes the local-path storage class to be re-registered as the default. See this issue. Consider disabling it entirely, or just be aware that occasionally you’ll get Internal error occurred: 2 default StorageClasses were found errors, and you’ll have to patch it again.

Create ingress for Longhorn UI:

kubectl apply -f ingress.yaml --namespace longhorn