Installing Longhorn: A Comprehensive Guide
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:
- Rancher Apps & Marketplace
- Helm
- 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
- Navigate to the Apps & Marketplace section in Rancher.
- Search for Longhorn.
- Click on Install.
- Use the default values (sufficient for most cases) or customize them as needed.
- 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
- Create a
values.yaml
file with your desired configuration. - Add the Longhorn Helm repository:
helm repo add longhorn https://charts.longhorn.io helm repo update
- 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
- 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
Set Up Helm Repository:
helm repo add longhorn https://charts.longhorn.io helm repo update
Install Longhorn:
helm install longhorn longhorn/longhorn --namespace longhorn-system --create-namespace --version 1.5.3
Verify Installation:
kubectl -n longhorn-system get pod -w
Useful Commands
Here are some handy commands to aid your installation process:
Environment Check:
curl https://raw.githubusercontent.com/longhorn/longhorn/v1.5.3/scripts/environment_check.sh | bash
Set Up Helm Repository:
helm repo add longhorn https://charts.longhorn.io helm repo update
Install Longhorn with Helm:
helm install longhorn longhorn/longhorn --namespace longhorn-system --create-namespace --version 1.5.3
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.