Skip to content

Latest commit

 

History

History
134 lines (101 loc) · 4.63 KB

Setup-Longhorn.md

File metadata and controls

134 lines (101 loc) · 4.63 KB

logo

💙🤍Setup Longhorn🤍💙

📘Table of Contents

  1. 📘Table of Contents
  2. 🖖Introduction
  3. ✨Steps
    1. 👉Step 1: Test if the system is ready for Longhorn
    2. 👉Step 2: Install Longhorn
    3. 👉Step 3: Check the status of the pods
    4. 👉Step 4: Check the status of the Longhorn system
    5. 👉Step 5: Get the storage class
    6. 👉Step 6: Create a basic authentication file
    7. 👉Step 7: Create a secret
    8. 👉Step 8: Set up a ingress controller
    9. 👉Step 9: Access the Longhorn UI
    10. 👉Step 10: Enable storage replica on worker notes
  4. 🔗Links

🖖Introduction

This document provides a step-by-step guide to installing Longhorn on the servers (nodes) in the supercluster. The steps outlined in this document are essential for ensuring the proper functioning of the servers (nodes) and the supercluster.

✨Steps

👉Step 1: Test if the system is ready for Longhorn

bash <(curl -s https://raw.githubusercontent.com/longhorn/longhorn/refs/tags/v1.7.2/scripts/environment_check.sh)

Let's see some common problems.

  • Problem 1: A kernel module is missing
modinfo iscsi_tcp                                   # Check if the module is available
sudo modprobe iscsi_tcp                             # Load the module
echo "iscsi_tcp" | sudo tee -a /etc/modules         # Add the module to the list of modules to load at boot
lsmod | grep iscsi_tcp                              # Check if the module is loaded
  • Problem 2: The multipathd service is running
sudo systemctl stop multipathd                      # Stop the multipathd service
sudo systemctl disable multipathd                   # Disable the multipathd service
systemctl status multipathd                         # Check the status of the multipathd service
  • Problem 3: The nfs-common package is not installed
sudo apt-get update && sudo apt-get upgrade -y      # Update and upgrade the system
sudo apt-get install -y nfs-common                  # Install the nfs-common package
dpkg -l | grep nfs-common                           # Check if the nfs-common package is installed

👉Step 2: Install Longhorn

kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.7.2/deploy/longhorn.yaml
# kubectl delete -f https://raw.githubusercontent.com/longhorn/longhorn/v1.7.2/deploy/longhorn.yaml
# kubectl get namespace longhorn-system -o json > longhorn-system.json
# sudo nano longhorn-system.json
# delete -> "kubernetes" -> "finalizers"
# kubectl replace --raw "/api/v1/namespaces/longhorn-system/finalize" -f longhorn-system.json

👉Step 3: Check the status of the pods

kubectl get pods --namespace longhorn-system --watch # OPTIONAL

👉Step 4: Check the status of the Longhorn system

kubectl -n longhorn-system get pods # OPTIONAL

👉Step 5: Get the storage class

kubectl get storageclass # OPTIONAL

👉Step 6: Create a basic authentication file

USER=<USERNAME_HERE>; PASSWORD=<PASSWORD_HERE>; echo "${USER}:$(openssl passwd -stdin -apr1 <<< ${PASSWORD})" >> auth

👉Step 7: Create a secret

kubectl create secret generic basic-auth -n longhorn-system --from-file=auth
rm auth
# kubectl delete secret basic-auth -n longhorn-system

👉Step 8: Set up a ingress controller

kubectl apply -f Ingress.yaml
# Service name: longhorn-frontend
# Namespace: longhorn-system
# Port: 8080

👉Step 9: Access the Longhorn UI

kubectl get ingress -A

👉Step 10: Enable storage replica on worker notes

kubectl label node node01 longhorn.io/target=true
kubectl label node node02 longhorn.io/target=true
kubectl label node node03 longhorn.io/target=true
kubectl label node node01 node-role.kubernetes.io/longhorn=true
kubectl label node node02 node-role.kubernetes.io/longhorn=true
kubectl label node node03 node-role.kubernetes.io/longhorn=true

🔗Links