Installing Longhorn: A Comprehensive Guide
On this page
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.
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.yamlfile with your desired configuration. - Add the Longhorn Helm repository:bash
helm repo add longhorn https://charts.longhorn.io helm repo update - Install Longhorn using Helm:bash
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 -wkubectl
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:bash
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 -wLab Instructions: Installing Longhorn with Helm
In this lab, we will install Longhorn using Helm.
Steps
Set Up Helm Repository:
bashhelm repo add longhorn https://charts.longhorn.io helm repo updateInstall Longhorn:
bashhelm install longhorn longhorn/longhorn --namespace longhorn-system --create-namespace --version 1.5.3Verify Installation:
bashkubectl -n longhorn-system get pod -w
Useful Commands
Here are some handy commands to aid your installation process:
Environment Check:
bashcurl https://raw.githubusercontent.com/longhorn/longhorn/v1.5.3/scripts/environment_check.sh | bashSet Up Helm Repository:
bashhelm repo add longhorn https://charts.longhorn.io helm repo updateInstall Longhorn with Helm:
bashhelm install longhorn longhorn/longhorn --namespace longhorn-system --create-namespace --version 1.5.3Verify Installation:
bashkubectl -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.