|
1 | 1 | # Longhorn on Talos Linux - Setup Guide |
2 | 2 |
|
3 | | -## Environment Check Results |
| 3 | +## Prerequisites |
| 4 | + |
| 5 | +### Talos Worker Node Configuration |
| 6 | + |
| 7 | +**IMPORTANT**: Worker nodes must have kubelet extraMounts configured for Longhorn to work properly. This is already configured in `cluster.tf` for all worker nodes: |
| 8 | + |
| 9 | +```hcl |
| 10 | +config_patches = [ |
| 11 | + yamlencode({ |
| 12 | + machine = { |
| 13 | + kubelet = { |
| 14 | + extraMounts = [ |
| 15 | + { |
| 16 | + destination = "/var/lib/longhorn" |
| 17 | + type = "bind" |
| 18 | + source = "/var/lib/longhorn" |
| 19 | + options = ["bind", "rshared", "rw"] |
| 20 | + } |
| 21 | + ] |
| 22 | + } |
| 23 | + } |
| 24 | + }) |
| 25 | +] |
| 26 | +``` |
4 | 27 |
|
5 | | -The Longhorn environment check script shows several warnings/errors that are **expected and safe to ignore** on Talos Linux: |
| 28 | +After applying Terraform changes to worker configurations, **reboot the worker nodes** for kubelet changes to take effect: |
6 | 29 |
|
7 | | -### ✅ Safe to Ignore (Talos-specific) |
| 30 | +```bash |
| 31 | +talosctl reboot --nodes 10.0.0.73 |
| 32 | +talosctl reboot --nodes 10.0.0.74 |
| 33 | +talosctl reboot --nodes 10.0.0.75 |
| 34 | +``` |
8 | 35 |
|
9 | | -1. **Kernel detection failures** - Talos doesn't have bash in nsenter containers |
10 | | -2. **OS detection failures** - Same reason as above |
11 | | -3. **iscsid service warnings** - Talos uses `ext-iscsid` instead of traditional `iscsid.service` |
| 36 | +## Quick Installation |
12 | 37 |
|
13 | | -### ✅ Verified Working |
| 38 | +Use the provided installation script for a complete setup: |
14 | 39 |
|
15 | | -All Talos worker nodes have `ext-iscsid` service running: |
16 | 40 | ```bash |
17 | | -talosctl services | grep ext-iscsid |
18 | | -# ext-iscsid Running |
| 41 | +./longhorn-install.sh |
19 | 42 | ``` |
20 | 43 |
|
21 | | -## Talos Configuration Requirements |
| 44 | +This script will: |
| 45 | +1. Create the `longhorn-system` namespace with proper pod security labels |
| 46 | +2. Install Longhorn via Helm |
| 47 | +3. Expose the UI on NodePort 30080 |
| 48 | +4. Configure storage disks on all worker nodes |
22 | 49 |
|
23 | | -Longhorn works on Talos with the following considerations: |
| 50 | +## Manual Installation |
24 | 51 |
|
25 | | -1. **iSCSI Support**: Talos includes `ext-iscsid` by default (verified running) |
26 | | -2. **Kernel Version**: 6.12.57-talos (exceeds minimum requirement of 5.8) |
27 | | -3. **Storage**: Raw block devices available on worker nodes |
| 52 | +### Step 1: Create Namespace |
28 | 53 |
|
29 | | -## Installation |
| 54 | +```bash |
| 55 | +kubectl create namespace longhorn-system |
| 56 | +kubectl label namespace longhorn-system \ |
| 57 | + pod-security.kubernetes.io/enforce=privileged \ |
| 58 | + pod-security.kubernetes.io/audit=privileged \ |
| 59 | + pod-security.kubernetes.io/warn=privileged |
| 60 | +``` |
30 | 61 |
|
31 | | -Install Longhorn using the provided values file: |
| 62 | +### Step 2: Install Longhorn |
32 | 63 |
|
33 | 64 | ```bash |
34 | 65 | helm repo add longhorn https://charts.longhorn.io |
35 | 66 | helm repo update |
36 | 67 | helm install longhorn longhorn/longhorn \ |
37 | | - --namespace longhorn-system \ |
38 | | - --create-namespace \ |
39 | | - --values longhorn-values.yaml |
| 68 | + --namespace longhorn-system \ |
| 69 | + --set defaultSettings.createDefaultDiskLabeledNodes=true \ |
| 70 | + --set persistence.defaultClassReplicaCount=3 |
| 71 | +``` |
| 72 | + |
| 73 | +### Step 3: Expose UI |
| 74 | + |
| 75 | +```bash |
| 76 | +kubectl patch svc longhorn-frontend -n longhorn-system \ |
| 77 | + -p '{"spec": {"type": "NodePort", "ports": [{"port": 80, "targetPort": 8000, "nodePort": 30080}]}}' |
| 78 | +``` |
| 79 | + |
| 80 | +### Step 4: Configure Storage Disks |
| 81 | + |
| 82 | +```bash |
| 83 | +# For each worker node |
| 84 | +kubectl patch nodes.longhorn.io talos-worker-01 -n longhorn-system --type='merge' \ |
| 85 | + -p '{"spec":{"disks":{"default-disk":{"path":"/var/lib/longhorn","allowScheduling":true,"storageReserved":0}}}}' |
| 86 | + |
| 87 | +kubectl patch nodes.longhorn.io talos-worker-02 -n longhorn-system --type='merge' \ |
| 88 | + -p '{"spec":{"disks":{"default-disk":{"path":"/var/lib/longhorn","allowScheduling":true,"storageReserved":0}}}}' |
| 89 | + |
| 90 | +kubectl patch nodes.longhorn.io talos-worker-03 -n longhorn-system --type='merge' \ |
| 91 | + -p '{"spec":{"disks":{"default-disk":{"path":"/var/lib/longhorn","allowScheduling":true,"storageReserved":0}}}}' |
40 | 92 | ``` |
41 | 93 |
|
42 | | -## Post-Installation |
| 94 | +## Access |
| 95 | + |
| 96 | +- **Longhorn UI**: http://<worker-node-ip>:30080 |
| 97 | +- **Worker IPs**: 10.0.0.73, 10.0.0.74, 10.0.0.75 |
43 | 98 |
|
44 | | -1. Access Longhorn UI via NodePort on port 30080 |
45 | | -2. Manually add disks in the UI for each worker node |
46 | | -3. Verify volume provisioning works |
| 99 | +## Verification |
| 100 | + |
| 101 | +Check storage status: |
| 102 | +```bash |
| 103 | +kubectl get nodes.longhorn.io -n longhorn-system -o jsonpath='{range .items[*]}{.metadata.name}: {.status.diskStatus.default-disk.storageAvailable}{"\n"}{end}' |
| 104 | +``` |
| 105 | + |
| 106 | +Check all pods are running: |
| 107 | +```bash |
| 108 | +kubectl get pods -n longhorn-system |
| 109 | +``` |
| 110 | + |
| 111 | +## Talos-Specific Notes |
| 112 | + |
| 113 | +### ✅ Safe to Ignore |
| 114 | + |
| 115 | +1. **Kernel detection failures** - Talos doesn't have bash in nsenter containers |
| 116 | +2. **OS detection failures** - Same reason as above |
| 117 | +3. **iscsid service warnings** - Talos uses `ext-iscsid` instead of traditional `iscsid.service` |
| 118 | + |
| 119 | +### ✅ Verified Working |
| 120 | + |
| 121 | +- **iSCSI Support**: Talos includes `ext-iscsid` by default |
| 122 | +- **Kernel Version**: 6.12.57-talos (exceeds minimum requirement of 5.8) |
| 123 | +- **MountPropagation**: Enabled via kubelet extraMounts in Terraform |
47 | 124 |
|
48 | 125 | ## Troubleshooting |
49 | 126 |
|
50 | 127 | If volumes fail to attach, verify: |
| 128 | +- Worker nodes were rebooted after Terraform apply |
51 | 129 | - `ext-iscsid` is running: `talosctl services` |
52 | | -- Disks are properly formatted and added in Longhorn UI |
| 130 | +- Disks are configured: `kubectl get nodes.longhorn.io -n longhorn-system` |
53 | 131 | - CSI driver pods are healthy: `kubectl get pods -n longhorn-system` |
| 132 | + |
| 133 | +## Uninstall |
| 134 | + |
| 135 | +```bash |
| 136 | +helm uninstall longhorn -n longhorn-system |
| 137 | +kubectl delete ns longhorn-system |
| 138 | +``` |
0 commit comments