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.
Safe staging for this asset
This asset is staged first. The copied prompt tells the agent to inspect the staged files and ask before activating scripts, MCP config, or global config.
npx -y tokrepo@latest install ca7e61b6-353d-11f1-9bc6-00163e2b0d79 --target codexStages files first; activation requires review of the staged README and plan.
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
Rainbond — Cloud-Native Application Platform Without Kubernetes Expertise
Rainbond is an open-source cloud-native application management platform that abstracts away Kubernetes complexity, letting developers deploy, manage, and orchestrate containerized applications through a visual interface without writing YAML.
Quickwit — Cloud-Native Sub-Second Search Engine
Quickwit is a cloud-native search engine built in Rust for log management and distributed search on object storage. It indexes data directly to S3-compatible stores, enabling cost-efficient search at petabyte scale.
Apache Pulsar — Cloud-Native Distributed Messaging and Streaming
Apache Pulsar is a cloud-native distributed messaging and streaming platform. It combines the best of traditional messaging (like RabbitMQ) with streaming (like Kafka) — providing multi-tenancy, geo-replication, and tiered storage in a single system.
OrioleDB — Cloud-Native Storage Engine for PostgreSQL
OrioleDB is an open-source PostgreSQL extension that replaces the default storage engine with a modern cloud-native design, eliminating table bloat, reducing write amplification, and enabling S3-native storage.