2025-01-19 11:52:46 +01:00

TALOS Linux Tests

Install Talos Linux CLI

On Ubuntu 22.04:

curl -sL https://talos.dev/install | sh

Shell Auto-completion

mkdir ~/.oh-my-zsh/custom/plugins/talosctl
talosctl completion zsh > ~/.oh-my-zsh/custom/plugins/talosctl/_talosctl

Add talosctl to plugins within your ~/.zshrc.

Install Kubectl

Follow the installation guide at kubernetes.io.

$ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
$ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
$ echo "$(cat kubectl.sha256)  kubectl" | sha256sum --check
$ chmod +x kubectl
$ mv kubectl ~/.local/bin/

Install Talos from ISO

Warning

: At least until v1.9.0 use IPv4 for creating the cluster. Clusters build up on IPv6 show several errors starting from etcd not starting and so on.

Talos dashboard

  • Generate configuration (important use port 6443):
$ talosctl gen config test-cluster https://10.51.3.27:6443
generating PKI and tokens
Created /home/marcel/projects/talos_experimental/controlplane.yaml
Created /home/marcel/projects/talos_experimental/worker.yaml
Created /home/marcel/projects/talos_experimental/talosconfig
  • Identify disks in machine
$ talosctl -n 10.51.3.27  get disks --insecure 
NODE   NAMESPACE   TYPE   ID      VERSION   SIZE     READ ONLY   TRANSPORT   ROTATIONAL   WWID   MODEL           SERIAL
       runtime     Disk   loop0   1         74 MB    true                                                        
       runtime     Disk   sda     1         34 GB    false       virtio                          QEMU HARDDISK   
       runtime     Disk   sdb     1         69 GB    false       virtio                          QEMU HARDDISK   
       runtime     Disk   sr0     1         105 MB   false       sata                            QEMU DVD-ROM  

Setup first control plane node

  • Apply the control plane configuration to the machine:
$ talosctl apply-config --insecure -n 10.51.3.27 --file controlplane.yaml
  • Bootstrap Kubernetes on top of Talos (only needs to be run on the first controller node)
$ talosctl bootstrap --nodes 10.51.3.27 --endpoints 10.51.3.27 --talosconfig=./talosconfig
  • Download Kubernetes client config
$ talosctl kubeconfig --nodes 10.51.3.27 --endpoints 10.51.3.27 --talosconfig=./talosconfig
  • Check available Kubernetes nodes
$ kubectl get nodes 
NAME            STATUS     ROLES           AGE   VERSION
talos-k3z-dt3   NotReady   control-plane   41s   v1.32.0

Setup first worker node

  • Setup the worker node (same as for any following one)
$ talosctl apply-config --insecure -n 10.51.3.28 --file worker.yaml
  • List Talos cluster members
talosctl --nodes 10.51.3.27 --endpoints 10.51.3.27 --talosconfig=./talosconfig get members
NODE         NAMESPACE   TYPE     ID              VERSION   HOSTNAME        MACHINE TYPE   OS               ADDRESSES
10.51.3.27   cluster     Member   talos-8ti-dt2   3         talos-8ti-dt2   worker         Talos (v1.9.1)   ["10.51.3.28","2a13:fc80:1:1:be24:11ff:fe61:6055"]
10.51.3.27   cluster     Member   talos-k3z-dt3   1         talos-k3z-dt3   controlplane   Talos (v1.9.1)   ["10.51.3.27","2a13:fc80:1:1:be24:11ff:fee8:e163"]
  • List Kubernetes cluster members
$ kubectl get nodes
NAME            STATUS   ROLES           AGE     VERSION
talos-8ti-dt2   Ready    <none>          19s     v1.32.0
talos-k3z-dt3   Ready    control-plane   5m32s   v1.32.0

Preparing a Talos Node for a re-install

Warning

: This clear any data on the machine!

Read Resetting a Machine for details.

$ talosctl --nodes 10.51.3.28 --endpoints 10.51.3.27 --talosconfig=./talosconfig reset --graceful --reboot
◲ watching nodes: [10.51.3.28]
watching nodes: [10.51.3.28]
    * 10.51.3.28: post check passed

Production Cluster install

Network setup

  • IPv4 configuration uses DHCP with static MAC binding for easy bring-up
  • IPv6 addresses are manually assigned
  • DNS Zone: prod.k8.eis-mk8.de.s5b.org
VLAN IPv4 IPv6
210 10.51.10.0/23 2a13:fc80:1:a::/64

Cluster creation

$ talosctl gen secrets -o secrets.yaml
$ talosctl gen config --with-secrets secrets.yaml eis-mk8-prod https://ctl.prod.k8.eis-mk8.de.s5b.org:6443

Setting static IPv4 and IPv6 addresses

  1. Create the patch, e.g. ctl-1.patch

  2. Create host specific config by patching the template (in this case controlplane.yaml):

$ talosctl machineconfig patch controlplane.yaml --patch @ctl-1.patch --output ctl-1.yaml
  1. Validate config
$ talosctl --cluster eis-mk8-prod --talosconfig talosconfig  validate -c controlplane.yaml -m metal
controlplane.yaml is valid for metal mode
  1. Apply configuration to the 1st control plane node
$ talosctl apply-config --insecure --nodes 10.51.10.101 --file ctl-1.yaml
talosctl --nodes 10.51.10.101 --endpoints 10.51.10.101 --talosconfig=./talosconfig kubeconfig

Apply configuration after initial node config

$ talosctl apply-config --nodes 10.51.10.101 --endpoints 10.51.10.101 --talosconfig=./talosconfig --file ctl-1.yaml

Get network addresses and interfaces

$ talosctl --nodes 10.51.10.101 --endpoints 10.51.10.101 --talosconfig=./talosconfig get address
Description
S5B.org Kubernetes setup
Readme 531 KiB
Languages
HCL 77%
Shell 19%
Dockerfile 4%