In this section of the Longhorn Basics course, we explore the different ways to install Longhorn, Rancher’s cloud-native distributed block storage solution for Kubernetes.

Installation Guide for Longhorn

Course Agenda

There are three primary methods to install Longhorn:

  1. Rancher Apps & Marketplace
  2. Helm
  3. kubectl

Rancher Apps & Marketplace

The Rancher Apps & Marketplace provides the easiest way to install Longhorn. However, it requires Rancher to be set up in your environment.

Installation Steps

  1. Navigate to the Apps & Marketplace section in Rancher.
  2. Search for Longhorn.
  3. Click on Install.
  4. Use the default values (sufficient for most cases) or customize them as needed.
  5. Click on Install.

Wait for the installation to complete. Rancher will handle the entire process for you.


Helm

Helm offers a highly flexible way to install Longhorn, ideal for environments where customization is needed.

Installation Steps

  1. Create a values.yaml file with your desired configuration.
  2. Add the Longhorn Helm repository:
    helm repo add longhorn https://charts.longhorn.io
    helm repo update
    
  3. Install Longhorn using Helm:
    helm install longhorn longhorn/longhorn --namespace longhorn-system --create-namespace --version 1.5.3
    

Wait for the installation to complete and verify it:

kubectl -n longhorn-system get pod -w

kubectl

Installing Longhorn with kubectl is straightforward but requires familiarity with Kubernetes manifests and Longhorn configuration if customization is needed.

Installation Steps

  1. Apply the Longhorn manifests:
    kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.5.3/deploy/longhorn.yaml
    

Wait for the installation to complete and verify it:

kubectl -n longhorn-system get pod -w

Lab Instructions: Installing Longhorn with Helm

In this lab, we will install Longhorn using Helm.

Steps

  1. Set Up Helm Repository:

    helm repo add longhorn https://charts.longhorn.io
    helm repo update
    
  2. Install Longhorn:

    helm install longhorn longhorn/longhorn --namespace longhorn-system --create-namespace --version 1.5.3
    
  3. Verify Installation:

    kubectl -n longhorn-system get pod -w
    

Useful Commands

Here are some handy commands to aid your installation process:

  1. Environment Check:

    curl https://raw.githubusercontent.com/longhorn/longhorn/v1.5.3/scripts/environment_check.sh | bash
    
  2. Set Up Helm Repository:

    helm repo add longhorn https://charts.longhorn.io
    helm repo update
    
  3. Install Longhorn with Helm:

    helm install longhorn longhorn/longhorn --namespace longhorn-system --create-namespace --version 1.5.3
    
  4. Verify Installation:

    kubectl -n longhorn-system get pod -w
    

Conclusion

This concludes the section on installing Longhorn. With multiple methods to choose from, you can select the one that best fits your environment and requirements. In the next section, we will explore how to use Longhorn for persistent storage and more advanced functionalities.