Add longhorn distributed storage to the k3s-cluster

This change adds longhorn, an addition to Kubernetes that adds the
ability to use distributed storage over all nodes to the cluster.

Note, that I tried that in December already but due to very high load on
the machines I rolled _everything_ back. Though, it turned out that the
high load was not because of longhorn, but instead because of bad
configuration of the server, as described in the see-also commit.

Reference: https://longhorn.io/
Reference: https://longhorn.io/docs/1.10.1/deploy/install/install-with-helm/
See-also: 4b8a3d12c4 Use etcd instead of sqlite for k3s-server
This commit is contained in:
2026-01-23 00:34:58 +01:00
parent 4b8a3d12c4
commit 1f69c1578c
6 changed files with 90 additions and 0 deletions

View File

@@ -118,6 +118,7 @@ Ansible installs and maintains all cluster software, including:
* Routing and SSH setup on servers
* A full k3s Kubernetes cluster
* Distributed block-storage via https://longhorn.io/[longhorn]
* Foundational cluster services
[NOTE]
@@ -140,6 +141,23 @@ Backup your config if you manage multiple clusters.
The Kubernetes setup requires an `inventory.ini` file, which Tofu creates automatically.
So, make sure to apply the infrastructure at least once before running Ansible.
=== Longhorn
The setup installs https://longhorn.io/[Longhorn], which provides a distributed block-storage system for the Kubernetes cluster.
Longhorn exposes a default storage class named `longhorn`.
This storage class is backed by replicated volumes distributed across multiple nodes,
reducing dependency on node-local ephemeral storage and allowing workloads to be rescheduled more reliably.
Longhorn also provides a web-based dashboard for inspecting volumes, replicas, and node health.
To access the dashboard, forward the service port:
[source,bash]
kubectl port-forward -n longhorn-system --address 0.0.0.0 service/longhorn-frontend 8000:80
Then open http://localhost:8000/ in your browser.
=== Installed Foundational Services
https://cert-manager.io/docs/installation/helm[cert-manager]::
@@ -167,6 +185,8 @@ You can restrict playbook scope to specific areas using `--tags`.
`add-server`:: Add a new k3s server node
`add-agent`:: Add a new k3s agent node
`update`:: Upgrade Kubernetes or system packages
`longhorn-compatible`:: Ensure longhorn-compatibility
`longhorn`:: Deploy longhorn
`config`:: Update local kubeconfig
`k8s`:: Deploy foundational services
@@ -216,4 +236,5 @@ Ansible::
* Configure routing on all servers
* Install and maintain k3s
* Keep system software updated
* Install longhorn
* Deploy foundational services