Cluster setup
Talos Linux v1.12.2 will be used as the OS on all nodes. Before installing Talos on the machines, make sure to install talosctl and kubectl on your laptop/PC:
Note
Alternatively, you can install the above without using brew:
Next, prepare a USB drive with the bare-metal Talos ISO image generated by the Image Factory Talos Linux. I used following configuration to generate the image for the computers that are part of my cluster:
- Hardware Type - Bare-metal Machine
- Talos Linux Version - for the sake of this setup - 1.12.2
- Machine Architecture - amd64
- Secure Boot - off
- System Extensions - none
- Customization - none
- Bootloader - auto
Configuration patches
Before setting up the control plane and workers, we need to prepare basic configuration patches for Talos. These consist of a file with secrets and patches for nodes. To generate the secret bundle file:
Apart from that, the repository contains patches:patch-overlord0.yml- patch for control plane configurationpatch-worker0.yml- patch for worker0 configurationpatch-worker1.yml- patch for worker1 configurationpatch-worker2.yml- patch for worker2 configurationpatch-worker3.yml- patch for worker3 configuration
These will be used as arguments for the talosctl gen config command.
The most important change in the patches is the diskSelector rule, which matches the disk that Talos will be installed on based on the model name expression. Without this, Talos always installs on /dev/sda. In my case, when installing Talos on the control plane node, this device was the USB drive with the Talos ISO. The goal is to install Talos on the server's hard drive so that the USB drive is no longer needed.
Control plane node setup
To set up a server node, follow these steps:
- In BIOS, set the secure boot configuration to Legacy Support Disable and Secure Boot Disable.
- Type in the confirmation code to disable secure boot.
- Plug the USB drive into the rear USB port of the device.
- Boot from the USB drive and wait for Talos to start and reach the READY state.
- With Talos started, it's time to set up the master node and cluster:
- Save the IP address to a variable (accessible from the Talos dashboard):
- Generate the control plane and Talos configuration using the secrets and patch:
- Apply the configuration to the machine (this step will trigger Talos installation to disk):
- Wait for the installation to complete, which will end with a system restart.
- Wait for Talos
Kubeletto reach a healthy state. - With Talos ready, set up Kubernetes:
- Wait until all checkboxes under controlplane are healthy and the READY state is true.
- Shut down the machine, unplug the USB drive, and start it again.
- Make sure everything works fine:
- Set up the kubectl configuration:
- Check the Kubernetes configuration:
- Access the Talos dashboard remotely:
After completing the above steps, the cluster should be set up and ready to accept workers.
Note
If you want to overwrite kubectl config based on the rendered talos configuration, you can use the following command:
Worker node setup
Now that the cluster is set up with the controlplane node, it's time to add worker nodes:
- First, set up the machine. For that, follow steps 1-4 from the previous instructions.
- With Talos started on the machine, configure a worker node:
- Save the IP address to a variable (accessible from the Talos dashboard) and save the control plane IP:
- Generate the worker configuration using the secrets and patch:
- Apply the configuration to the machine (this step will trigger Talos installation to disk):
- Wait for the installation to finish.
- Once finished, check if the worker has successfully joined the cluster:
- Shut down the machine, remove the USB drive, and start it again.
- After some time, check if the node is in the READY status:
- Check the dashboard:
The instructions above work for a single worker. Before adding another worker to the cluster, you have to create a patch file in /cluster-config/patches for the worker and change the WORKER_IP and WORKER variables in the instructions.
At this point, the cluster is set up and ready for service deployment.
Sources:
- https://docs.siderolabs.com/talos/v1.12/
- https://docs.siderolabs.com/talos/v1.12/getting-started/prodnotes
- https://docs.siderolabs.com/talos/v1.12/reference/configuration/network/hostnameconfig
- https://docs.siderolabs.com/talos/v1.12/configure-your-talos-cluster/system-configuration/patching
- https://github.com/siderolabs/talos/discussions/9256
- https://github.com/siderolabs/talos/discussions/10081
- https://github.com/siderolabs/talos/issues/9369
- https://factory.talos.dev
- https://datavirke.dk/posts/bare-metal-kubernetes-part-1-talos-on-hetzner/