Skip to main content

Pre-requisities

  1. Linux OS
  2. Vagrant installed
  3. vagrant-libvirt plugin installed
  4. talosctl installed
  5. kubectl installed

Overview

We will use Vagrant and its libvirt plugin to create a KVM-based cluster with 3 control plane nodes and 1 worker node. For this, we will mount Talos ISO into the VMs using a virtual CD-ROM, and configure the VMs to attempt to boot from the disk first with the fallback to the CD-ROM. We will also configure a virtual IP address on Talos to achieve high-availability on kube-apiserver.

Preparing the environment

First, we download the latest metal-amd64.iso ISO from GitHub releases into the /tmp directory. Create a Vagrantfile with the following contents:

Bring up the nodes

Check the status of vagrant VMs:
You should see the VMs in “not created” state:
Bring up the vagrant environment:
Check the status again:
Now you should see the VMs in “running” state:
Find out the IP addresses assigned by the libvirt DHCP by running:
Output will look like the following:
Our control plane nodes have the IPs: 192.168.121.203, 192.168.121.119, 192.168.121.125 and the worker node has the IP 192.168.121.69. Now you should be able to interact with Talos nodes that are in maintenance mode:
Sample output:

Installing Talos

Pick an endpoint IP in the vagrant-libvirt subnet but not used by any nodes, for example 192.168.121.100. Create a patch.yaml file with the following contents and add the virtual IP you picked to a network interface under .machine.network.interfaces:
Edit controlplane.yaml to add the virtual IP you picked to a network interface under .machine.network.interfaces, for example:
Generate a machine configuration:
Apply the configuration to the initial control plane node:
You can tail the logs of the node:
Set up your shell to use the generated talosconfig and configure its endpoints (use the IPs of the control plane nodes):
Bootstrap the Kubernetes cluster from the initial control plane node:
Finally, apply the machine configurations to the remaining nodes:
After a while, you should see that all the members have joined:
The output will be like the following:

Interacting with Kubernetes cluster

Retrieve the kubeconfig from the cluster:
List the nodes in the cluster:
You will see an output similar to:
Congratulations, you have a highly-available Talos cluster running!

Cleanup

You can destroy the vagrant environment by running:
And remove the ISO image you downloaded: