Longhorn — Cloud Native Distributed Block Storage for Kubernetes
Longhorn is a lightweight, reliable distributed block storage system for Kubernetes. Persistent volumes with replication, snapshots, backups, and disaster recovery.
What it is
Longhorn is a lightweight, reliable distributed block storage system for Kubernetes. It provides persistent volumes with built-in replication, snapshots, scheduled backups to S3-compatible storage, and disaster recovery. Each volume is an independent microservice managed by its own controller, which simplifies troubleshooting and prevents a single storage failure from affecting the entire cluster.
Longhorn targets Kubernetes administrators who need persistent storage without deploying heavyweight solutions like Ceph or GlusterFS. It is a CNCF incubating project maintained by SUSE/Rancher.
How it saves time or tokens
Setting up distributed storage on Kubernetes traditionally requires deep expertise in storage systems. Longhorn installs with a single kubectl apply and manages itself. Automatic replication ensures data survives node failures. Scheduled backups to S3 eliminate manual backup scripts. The built-in UI provides volume health, replica status, and snapshot management without additional tooling.
How to use
- Install Longhorn on your Kubernetes cluster:
kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.6.0/deploy/longhorn.yaml
- Wait for installation to complete:
kubectl -n longhorn-system get pods -w
- Create a PersistentVolumeClaim using the Longhorn storage class:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-data
spec:
accessModes:
- ReadWriteOnce
storageClassName: longhorn
resources:
requests:
storage: 10Gi
Example
Configuring automated S3 backups:
# Create a backup target secret
apiVersion: v1
kind: Secret
metadata:
name: s3-backup-target
namespace: longhorn-system
stringData:
AWS_ACCESS_KEY_ID: 'your-key'
AWS_SECRET_ACCESS_KEY: 'your-secret'
AWS_ENDPOINTS: 'https://s3.amazonaws.com'
Then set the backup target in Longhorn Settings to s3://my-backup-bucket@us-east-1/ and schedule recurring backups per volume.
Related on TokRepo
- AI Tools for DevOps — Kubernetes infrastructure and storage tools
- AI Tools for Self-Hosted — self-hosted infrastructure solutions
Common pitfalls
- Longhorn requires open-iscsi installed on all worker nodes; missing this dependency causes volume mount failures
- Three replicas (the default) require at least three nodes with available disk space; adjust the replica count for smaller clusters
- Snapshots consume disk space proportional to data changes; configure snapshot cleanup policies to prevent disk exhaustion
Frequently Asked Questions
Longhorn is simpler to deploy and manage but has a smaller feature set. Ceph supports block, file, and object storage with advanced features like erasure coding. Longhorn focuses on block storage with a lightweight architecture. Choose Longhorn for simplicity and Ceph for scale and versatility.
Longhorn primarily supports ReadWriteOnce (RWO) volumes. ReadWriteMany (RWX) is supported through an NFS-based mechanism, but performance may be lower than dedicated NFS or CephFS solutions.
Each Longhorn volume maintains multiple replicas (default: 3) on different nodes. Writes are synchronously replicated to all healthy replicas. If a node fails, the remaining replicas continue serving the volume, and Longhorn automatically rebuilds the missing replica on another node.
Yes. Longhorn supports incremental backups to any S3-compatible storage (AWS S3, MinIO, Backblaze B2). You can schedule recurring backups and restore them to create new volumes, even on a different cluster for disaster recovery.
Longhorn is a CNCF incubating project used in production by organizations running stateful workloads on Kubernetes. SUSE/Rancher provides commercial support through Rancher Prime.
Citations (3)
- Longhorn GitHub— Longhorn distributed block storage
- Longhorn Docs— Longhorn documentation and architecture
- CNCF Landscape— CNCF incubating project
Related on TokRepo
Discussion
Related Assets
NAPI-RS — Build Node.js Native Addons in Rust
Write high-performance Node.js native modules in Rust with automatic TypeScript type generation and cross-platform prebuilt binaries.
Mamba — Fast Cross-Platform Package Manager
A drop-in conda replacement written in C++ that resolves environments in seconds instead of minutes.
Plasmo — The Browser Extension Framework
Build, test, and publish browser extensions for Chrome, Firefox, and Edge using React or Vue with hot-reload and automatic manifest generation.