Skip to content
Cloud native, distributed block storage build on and for Kubernetes
Branch: master
Clone or download
Latest commit 947799d Jun 8, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
chart Update May 18, 2019
deploy Sync with manager: May 18, 2019
docs Update Jun 7, 2019
examples Sync with Manager May 14, 2019
scripts Sync with Longhorn Manager Nov 8, 2018
uninstall Sync with manager: May 18, 2019
LICENSE Initial commit Apr 14, 2017 Merge pull request #561 from rancher/v0.5.0 May 18, 2019


Longhorn is a distributed block storage system for Kubernetes.

Longhorn is lightweight, reliable, and powerful. You can install Longhorn on an existing Kubernetes cluster with one kubectl apply command or using Helm charts. Once Longhorn is installed, it adds persistent volume support to the Kubernetes cluster.

Longhorn implements distributed block storage using containers and microservices. Longhorn creates a dedicated storage controller for each block device volume and synchronously replicates the volume across multiple replicas stored on multiple nodes. The storage controller and replicas are themselves orchestrated using Kubernetes. Here are some notable features of Longhorn:

  1. Enterprise-grade distributed storage with no single point of failure
  2. Incremental snapshot of block storage
  3. Backup to secondary storage (NFS or S3-compatible object storage) built on efficient change block detection
  4. Recurring snapshot and backup
  5. Automated non-disruptive upgrade. You can upgrade the entire Longhorn software stack without disrupting running volumes!
  6. Intuitive GUI dashboard

You can read more technical details of Longhorn here.

Current status

Longhorn is alpha-quality software. We appreciate your willingness to deploy Longhorn and provide feedback.

The latest release of Longhorn is v0.5.0.

Source code

Longhorn is 100% open source software. Project source code is spread across a number of repos:

  1. Longhorn engine -- Core controller/replica logic
  2. Longhorn manager -- Longhorn orchestration, includes Flexvolume driver for Kubernetes
  3. Longhorn UI -- Dashboard

Longhorn UI


  1. Docker v1.13+
  2. Kubernetes v1.8+. Recommend v1.12+.
  3. open-iscsi has been installed on all the nodes of the Kubernetes cluster.
    1. For GKE, recommended Ubuntu as guest OS image since it contains open-iscsi already.
    2. For Debian/Ubuntu, use apt-get install open-iscsi to install.
    3. For RHEL/CentOS, use yum install iscsi-initiator-utils to install.


On Kubernetes clusters Managed by Rancher 2.1 or newer

The easiest way to install Longhorn is to deploy Longhorn from Rancher Catalog.

  1. On Rancher UI, select the cluster and project you want to install Longhorn. We recommended to create a new project e.g. Storage for Longhorn.
  2. Navigate to the Catalog Apps screen. Select Launch, find Longhorn in the list. Select View Details, then click Launch. Longhorn will be installed in the longhorn-system namespace.

After Longhorn has been successfully installed, you can access the Longhorn UI by navigating to the Catalog Apps screen.

One benefit of installing Longhorn through Rancher catalog is Rancher provides authentication to Longhorn UI.

If there is a new version of Longhorn available, you will see an Upgrade Available sign on the Catalog Apps screen. You can click Upgrade button to upgrade Longhorn manager. See more about upgrade here.

On any Kubernetes cluster

Install Longhorn with kubectl

You can install Longhorn on any Kubernetes cluster using following command:

kubectl apply -f

Google Kubernetes Engine (GKE) requires additional setup in order for Longhorn to function properly. If your are a GKE user, read this page before proceeding.

Install Longhorn with Helm

First, you need to initialize Helm locally and install Tiller into your Kubernetes cluster with RBAC.

Then download Longhorn repository:

git clone

Now using following command to install Longhorn:

helm install ./longhorn/chart --name longhorn --namespace longhorn-system

Longhorn will be installed in the namespace longhorn-system

One of the two available drivers (CSI and Flexvolume) would be chosen automatically based on the version of Kubernetes you use. See here for details.

A successful CSI-based deployment looks like this:

# kubectl -n longhorn-system get pod
NAME                                        READY     STATUS    RESTARTS   AGE
csi-attacher-0                              1/1       Running   0          6h
csi-provisioner-0                           1/1       Running   0          6h
engine-image-ei-57b85e25-8v65d              1/1       Running   0          7d
engine-image-ei-57b85e25-gjjs6              1/1       Running   0          7d
engine-image-ei-57b85e25-t2787              1/1       Running   0          7d
longhorn-csi-plugin-4cpk2                   2/2       Running   0          6h
longhorn-csi-plugin-ll6mq                   2/2       Running   0          6h
longhorn-csi-plugin-smlsh                   2/2       Running   0          6h
longhorn-driver-deployer-7b5bdcccc8-fbncl   1/1       Running   0          6h
longhorn-manager-7x8x8                      1/1       Running   0          6h
longhorn-manager-8kqf4                      1/1       Running   0          6h
longhorn-manager-kln4h                      1/1       Running   0          6h
longhorn-ui-f849dcd85-cgkgg                 1/1       Running   0          5d

Accessing the UI

You can run kubectl -n longhorn-system get svc to get the external service IP for UI:

NAME                TYPE           CLUSTER-IP      EXTERNAL-IP      PORT(S)        AGE
longhorn-backend    ClusterIP   <none>           9500/TCP       58m
longhorn-frontend   LoadBalancer  80:30697/TCP   58m

If the Kubernetes Cluster supports creating LoadBalancer, you can use EXTERNAL-IP( in the case above) of longhorn-frontend to access the Longhorn UI. Otherwise you can use <node_ip>:<port> (port is 30697in the case above) to access the UI.

Noted that the UI is unauthenticated when you installed Longhorn using YAML file.


Since v0.3.3, Longhorn is able to perform fully-automated non-disruptive upgrades, meaning that the upgrade process won't disrupt the running volumes. Existing volumes continue to run even as the software that implements these volumes are upgraded.

If you're upgrading from Longhorn v0.3.0 or newer:

Upgrade Longhorn manager

On Kubernetes clusters Managed by Rancher 2.1 or newer

Follow the same steps for installation to upgrade Longhorn manager

Using kubectl
kubectl apply -f`
Using Helm
helm upgrade longhorn ./longhorn/chart

Upgrade Longhorn engine

After upgraded manager, follow the steps here to upgrade Longhorn engine for existing volumes. 1. For non distruptive upgrade, follow the live upgrade steps here

For more details about upgrade in Longhorn or upgrade from older versions, see here.

Create Longhorn Volumes

Before you create Kubernetes volumes, you must first create a storage class. Use following command to create a StorageClass called longhorn.

kubectl create -f

Now you can create a pod using Longhorn like this:

kubectl create -f

The above yaml file contains two parts:

  1. Create a PVC using Longhorn StorageClass.
apiVersion: v1
kind: PersistentVolumeClaim
  name: longhorn-volv-pvc
    - ReadWriteOnce
  storageClassName: longhorn
      storage: 2Gi
  1. Use it in the a Pod as a persistent volume:
apiVersion: v1
kind: Pod
  name: volume-test
  namespace: default
  - name: volume-test
    image: nginx:stable-alpine
    imagePullPolicy: IfNotPresent
    - name: volv
      mountPath: /data
    - containerPort: 80
  - name: volv
      claimName: longhorn-volv-pvc

More examples are available at ./examples/


Snapshot and Backup

Volume operations

Multiple disks, including how to change the default path for storage


Base image

Kubernetes workload in Longhorn UI

Restoring Stateful Set volumes

Google Kubernetes Engine

Deal with Kubernetes node failure

Use CSI driver on RancherOS/CoreOS + RKE or K3S

Restore a backup to an image file

Disaster Recovery Volume


You can click Generate Support Bundle link at the bottom of the UI to download a zip file contains Longhorn related configuration and logs.

See here for the troubleshooting guide.

Uninstall Longhorn

Using kubectl

  1. To prevent damaging the Kubernetes cluster, we recommend deleting all Kubernetes workloads using Longhorn volumes (PersistentVolume, PersistentVolumeClaim, StorageClass, Deployment, StatefulSet, DaemonSet, etc) first.

  2. Create the uninstallation job to clean up CRDs from the system and wait for success:

kubectl create -f
kubectl get job/longhorn-uninstall -w

Example output:

$ kubectl create -f
serviceaccount/longhorn-uninstall-service-account created created created
job.batch/longhorn-uninstall created

$ kubectl get job/longhorn-uninstall -w
longhorn-uninstall   0/1           3s         3s
longhorn-uninstall   1/1           20s        20s
  1. Remove remaining components:
kubectl delete -f
kubectl delete -f

Tip: If you try kubectl delete -f first and get stuck there, pressing Ctrl C then running kubectl create -f can also help you remove Longhorn. Finally, don't forget to cleanup remaining components.

Using Helm

helm delete longhorn --purge


Copyright (c) 2014-2019 Rancher Labs, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

You can’t perform that action at this time.