Longhorn can be installed on a Kubernetes cluster in several ways:

To install Longhorn in an air gapped environment, refer to this section.

For information on customizing Longhorn’s default settings, refer to this section.

For information on deploying Longhorn on specific nodes and rejecting general workloads for those nodes, refer to the section on taints and tolerations.

Installation Requirements

Each node in the Kubernetes cluster where Longhorn is installed must fulfill the following requirements:

  • Docker v1.13+
  • Kubernetes v1.14+.
    • By default Longhorn installation requires a three-nodes cluster since the default replica count is 3 and the node level soft anti-affinity is disabled.
  • open-iscsi is installed, and the iscsid daemon is running on all the nodes. For help installing open-iscsi, refer to this section.
  • The host filesystem supports the file extents feature to store the data. Currently we support:
    • ext4
    • XFS
  • curl, findmnt, grep, awk, blkid, lsblk must be installed.
  • Mount propagation must be enabled.

This script can be used to check the Longhorn environment for potential issues.

For the minimum recommended hardware, refer to the best practices guide.

OS/Distro Specific Configuration

  • Google Kubernetes Engine (GKE) requires some additional setup for Longhorn to function properly. If you’re a GKE user, refer to this section for details.
  • K3s clusters require some extra setup. Refer to this section
  • RKE clusters with CoreOS need this configuration.

Using the Environment Check Script

We’ve written a script to help you gather enough information about the factors. Before installing, run:

  1. curl -sSfL https://raw.githubusercontent.com/longhorn/longhorn/master/scripts/environment_check.sh | bash

Example result:

  1. daemonset.apps/longhorn-environment-check created
  2. waiting for pods to become ready (0/3)
  3. all pods ready (3/3)
  4. MountPropagation is enabled!
  5. cleaning up...
  6. daemonset.apps "longhorn-environment-check" deleted
  7. clean up complete

Notes on Mount Propagation

If your Kubernetes cluster was provisioned by Rancher v2.0.7+ or later, the MountPropagation feature is enabled by default.

If MountPropagation is disabled, Base Image feature will be disabled.

Installing open-iscsi

The command used to install open-iscsi differs depending on the Linux distribution.

For GKE, we recommend using Ubuntu as the guest OS image since it containsopen-iscsi already.

You may need to edit the cluster security group to allow SSH access.

For Debian and Ubuntu, use this command:

  1. apt-get install open-iscsi

For RHEL, CentOS, and EKS with EKS Kubernetes Worker AMI with AmazonLinux2 image, use this command:

  1. yum install iscsi-initiator-utils

Checking the Kubernetes Version

Use the following command to check your Kubernetes server version

  1. kubectl version

Result:

  1. Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.3", GitCommit:"2bba0127d85d5a46ab4b778548be28623b32d0b0", GitTreeState:"clean", BuildDate:"2018-05-21T09:17:39Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
  2. Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.1", GitCommit:"d4ab47518836c750f9949b9e0d387f20fb92260b", GitTreeState:"clean", BuildDate:"2018-04-12T14:14:26Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}

The Server Version should be v1.10 or above.