Skills2026年4月11日·1 分钟阅读

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.

Agent 就绪

这个资产会安全暂存

这个资产会先安全暂存。复制的指令会要求 Agent 读取暂存文件,并在激活脚本、MCP 配置或全局配置前先确认。

Stage only · 29/100策略:需暂存
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Stage only
信任
信任等级:Established
入口
step-1.md
安全暂存命令
npx -y tokrepo@latest install ca7e61b6-353d-11f1-9bc6-00163e2b0d79 --target codex

先暂存文件;激活前需要读取暂存 README 和安装计划。

TL;DR
Lightweight distributed block storage for Kubernetes with replication, snapshots, and backups.
§01

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.

§02

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.

§03

How to use

  1. Install Longhorn on your Kubernetes cluster:
kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.6.0/deploy/longhorn.yaml
  1. Wait for installation to complete:
kubectl -n longhorn-system get pods -w
  1. 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
§04

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.

§05

Related on TokRepo

§06

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

常见问题

How does Longhorn compare to Ceph?+

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.

Does Longhorn support ReadWriteMany volumes?+

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.

How does replication work?+

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.

Can I back up volumes to S3?+

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.

Is Longhorn production-ready?+

Longhorn is a CNCF incubating project used in production by organizations running stateful workloads on Kubernetes. SUSE/Rancher provides commercial support through Rancher Prime.

引用来源 (3)

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产