Longhorn is a lightweight, reliable and easy-to-use distributed block storage system for Kubernetes.

Longhorn is free, open source software. Originally developed by Rancher Labs, it is now being developed as a sandbox project of the Cloud Native Computing Foundation. It can be installed on any Kubernetes cluster with Helm, with kubectl, or with the Rancher UI. You can learn more about its architecture here.

With Longhorn, you can:

  • Use Longhorn volumes as persistent storage for the distributed stateful applications in your Kubernetes cluster
  • Partition your block storage into Longhorn volumes so that you can use Kubernetes volumes with or without a cloud provider
  • Replicate block storage across multiple nodes and data centers to increase availability
  • Store backup data in external storage such as NFS or AWS S3
  • Create cross-cluster disaster recovery volumes so that data from a primary Kubernetes cluster can be quickly recovered from backup in a second Kubernetes cluster
  • Schedule recurring snapshots of a volume, and schedule recurring backups to NFS or S3-compatible secondary storage
  • Restore volumes from backup
  • Upgrade Longhorn without disrupting persistent volumes

Longhorn Dashboard

Longhorn Dashboard

New in Rancher v2.5

Before Rancher v2.5, Longhorn could be installed as a Rancher catalog app. In Rancher v2.5, the catalog system was replaced by the Apps & Marketplace, and it became possible to install Longhorn as an app from that page.

The Cluster Explorer now allows you to manipulate Longhorn’s Kubernetes resources from the Rancher UI. So now you can control the Longhorn functionality with the Longhorn UI, or with kubectl, or by manipulating Longhorn’s Kubernetes custom resources in the Rancher UI.

These instructions assume you are using Rancher v2.5, but Longhorn can be installed with earlier Rancher versions. For documentation about installing Longhorn as a catalog app using the legacy Rancher UI, refer to the Longhorn documentation.

Installing Longhorn with Rancher

  1. Fulfill all Installation Requirements.
  2. Go to the Cluster Explorer in the Rancher UI.
  3. Click Apps.
  4. Click longhorn.
  5. Optional: To customize the initial settings, click Longhorn Default Settings and edit the configuration. For help customizing the settings, refer to the Longhorn documentation.
  6. Click Install.

Result: Longhorn is deployed in the Kubernetes cluster.

Accessing Longhorn from the Rancher UI

  1. From the **Cluster Explorer,” go to the top left dropdown menu and click Cluster Explorer > Longhorn.
  2. On this page, you can edit Kubernetes resources managed by Longhorn. To view the Longhorn UI, click the Longhorn button in the Overview section.

Result: You will be taken to the Longhorn UI, where you can manage your Longhorn volumes and their replicas in the Kubernetes cluster, as well as secondary backups of your Longhorn storage that may exist in another Kubernetes cluster or in S3.

Uninstalling Longhorn from the Rancher UI

  1. Click Cluster Explorer > Apps & Marketplace.
  2. Click Installed Apps.
  3. Go to the longhorn-system namespace and check the boxes next to the longhorn and longhorn-crd apps.
  4. Click Delete, and confirm Delete.

Result: Longhorn is uninstalled.

GitHub Repository

The Longhorn project is available here.

Documentation

The Longhorn documentation is here.

Architecture

Longhorn creates a dedicated storage controller for each volume and synchronously replicates the volume across multiple replicas stored on multiple nodes.

The storage controller and replicas are themselves orchestrated using Kubernetes.

You can learn more about its architecture here.

Longhorn Architecture

Longhorn Architecture