This guide will show you how to setup a Kubernetes cluster in Talos linux, this cluster will NOT be HA (High Availability).
1. Booting Talos #
We first need a ISO image on a USB to boot from, I will be using this image as it comes packed with the following:
- iscsi-tools (requirement of longhorn)
- qemu-guest-agent (because im running my cluster in proxmox)
- util-linux-tools (requirement of longhorn)
Once you have your ISO image, flash it to a USB with a tool such as Balena Etcher.
Boot from the USB, and there will be an IP address on the screen, this will be needed in the next steps. Make sure to give this server a static IP.
2. Installing Talos #
To install Talos Linux on your server, you need to use the talosctl
CLI tool.
I am on a mac, so I use the following command to install it.
brew install talosctl
You will also want to install the kubectl
CLI tool.
brew install kubectl
Once you have it installed, you may continue onto the next steps.
export TALOS_IP="10.77.1.105"
export TALOS_API_PORT="6443"
export CLUSTER_NAME="cluster-01"
Generate the config files #
talosctl gen config "${CLUSTER_NAME}" "https://${TALOS_IP}:${TALOS_API_PORT}"
If you are using a custom image like me, change it under machine.install.image
in both the controlplane.yaml
and worker.yaml
files.
Now we can apply the configuration file for the control plane to our server:
talosctl apply-config --insecure -n "${TALOS_IP}" --file controlplane.yaml
Once the server has rebooted, you can run the following commands
talosctl bootstrap --nodes "${TALOS_IP}" --endpoints "${TALOS_IP}" --talosconfig=./talosconfig
talosctl kubeconfig --nodes "${TALOS_IP}" --endpoints "${TALOS_IP}" --talosconfig=./talosconfig
you can now run kubectl get nodes
over and over again until you see that your node is Ready
.
3. Adding worker nodes to the cluster #
To add more nodes to the cluster, you would boot from the USB, grab the IP, then run the following command:
talosctl apply-config --insecure -n "10.77.1.106" --file worker.yaml
Because I have 3 workers, I ran the command 3 times, once per node.
talosctl apply-config --insecure -n "10.77.1.106" --file worker.yaml
talosctl apply-config --insecure -n "10.77.1.107" --file worker.yaml
talosctl apply-config --insecure -n "10.77.1.108" --file worker.yaml
4. Done #
If all went well, when you run kubectl get nodes
you should see an output like this:
NAME STATUS ROLES AGE VERSION
vm105 Ready control-plane 56m v1.34.0
vm106 Ready <none> 55m v1.34.0
vm107 Ready <none> 55m v1.34.0
vm108 Ready <none> 55m v1.34.0