docs: Add documentation for docker-cluster module

This commit is contained in:
2025-08-03 15:40:55 +02:00
parent 90de6441d6
commit b91eaed4b2
2 changed files with 42 additions and 3 deletions
+13 -3
View File
@@ -1,6 +1,16 @@
# Terraform
This repo contains the representation of all infrastructure on Hetzner, including domains from Inwx.
This repo contains the representation of all infrastructure on Hetzner.
It contains modules for a domain and a k8s cluster with MicroK8s on Hetzner. The k8s-cluster module supports
single and multi-node MicroK8s clusters. So far single node cluster have been successfully created.
## Modules
It contains modules for a domain (not really working), a k8s cluster with MicroK8s on Hetzner, and a Docker swarm cluster.
The k8s-cluster module supports single and multi-node MicroK8s clusters. So far, a single node cluster has been successfully created.
More information about the Docker cluster module can be found [here](docs/docker-cluster.md).
## Technical notes
The element function is used not by accident. It allows iterating over a list multiple times with an index higher than
the length of the list. IDEs may suggest using index access instead, but this will not work.
+29
View File
@@ -0,0 +1,29 @@
# Docker cluster
This module creates a number of Docker nodes on Hetzner.
Each node is prepared for running inside a Docker swarm cluster.
Due to limitations of Terraform, the nodes cannot be joined automatically and this has to be done manually.
The first manager node will be the first manager node of the Docker swarm cluster. You need to SSH onto it
with the configured SSH key and run the following commands to get the join tokens:
```bash
docker swarm join-token manager
docker swarm join-token worker
```
Afterward, you can join the other nodes by using the join commands from the first manager node.
The module does not create DNS records, and you need to create them manually. The output of the module
will contain the IP addresses of all the nodes.
Once you have more than one manager node, a load balancer will be created and configured to direct traffic to the
manager nodes, using the round-robin algorithm.
The firewall is configured to allow SSH to each node. HTTP and HTTPS are only allowed on the manager nodes.
Furthermore, all necessary ports for Docker swarm are opened on the private node ips.
The manager nodes will also receive a `github` user with the specified SSH key so that GitHub Actions can access the
nodes to deploy applications within the swarm.