Docs / Kubernetes & Orchestration / How to Set Up Longhorn Storage for Kubernetes

How to Set Up Longhorn Storage for Kubernetes

By Admin · Mar 1, 2026 · Updated Apr 23, 2026 · 31 views · 1 min read

Longhorn is a lightweight distributed block storage system for Kubernetes. It provides persistent volumes with built-in replication, snapshots, and backups.

Prerequisites

  • A Kubernetes or K3s cluster with at least two worker nodes
  • Each node must have open-iscsi installed
  • Available disk space on each node for replica storage

Install open-iscsi on All Nodes

sudo apt update && sudo apt install -y open-iscsi
sudo systemctl enable --now iscsid

Deploy Longhorn

Install using the official manifest or Helm chart:

kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.6.0/deploy/longhorn.yaml

Or with Helm:

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

Set as Default StorageClass

kubectl patch storageclass longhorn -p '{"metadata":{"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'

Create a Persistent Volume Claim

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: my-data
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: longhorn
  resources:
    requests:
      storage: 10Gi

Accessing the Dashboard

Longhorn includes a web UI for managing volumes and replicas:

kubectl port-forward -n longhorn-system svc/longhorn-frontend 8080:80
  • Configure backup targets to S3-compatible storage for disaster recovery
  • Set replica count based on your number of nodes (default is 3)

Was this article helpful?