Persistent Storage with Longhorn
Longhorn is a cloud-native distributed block storage system for Kubernetes. It provides persistent volumes that survive pod restarts and can replicate data across nodes.
What this page covers
- Why Longhorn over the default K3s local-path provisioner
- Installing Longhorn via Helm
- Setting Longhorn as the default StorageClass
- Configuring replica count for single-node vs. multi-node clusters
- Accessing the Longhorn UI
When to use Longhorn
The default K3s storage provisioner (local-path) stores data on a single node's disk. If that node fails, the data is inaccessible. Longhorn replicates volumes across nodes and supports snapshots and backups to S3-compatible storage.
For single-node deployments, Longhorn's replication overhead is unnecessary — local-path is sufficient. Use Longhorn when you have two or more nodes and want resilient storage.
Installation
helm repo add longhorn https://charts.longhorn.io
helm repo update
helm install longhorn longhorn/longhorn --namespace longhorn-system --create-namespace