- Tested Talos version:
1.11.5 - Test Xen Orchestra Provider version:
0.37.0
This example provides a Terraform alternative to using the Xen Orchestra UI for VM creation. It automates the VM provisioning step but requires pre-generated Talos configurations. Read the doc about Talos in Xen Orchestra to create the template VM.
This replaces steps 2 and 3 of the "Create the Talos cluster" section in the guide.
Key features:
- Creates VMs from a Talos template using Terraform
- Uses cloud-init to inject pre-generated Talos configurations (
controlplane.yamlandworker.yaml) - Default configuration: 1 control plane (no HA) and 1 worker node
- Requires manual cluster bootstrapping after VM creation
- Pre-generated Talos configurations (
controlplane.yamlandworker.yaml) - A Talos VM template created in Xen Orchestra
- Xen Orchestra API token
- Terraform installed
- No automatic bootstrapping - you must manually run
talosctl bootstrapafter VM creation - Single control plane node by default (no high availability)
- Requires generating Talos configurations externally before applying the plan
This example uses the Talos Terraform provider to fully automate the creation and configuration of a Talos cluster on Xen Orchestra. Read the doc about Talos in Xen Orchestra to create the template VM.
This is a complete end-to-end automation that replaces all steps of the "Create the Talos cluster" section of the guide.
Key features:
- Uses the Talos Terraform provider to generate machine configurations dynamically
- Configures Virtual IP (VIP) for control plane high availability
- Automatically bootstraps the Talos cluster
- Generates and outputs both
talosconfigandkubeconfig - Supports multiple control plane and worker nodes
- No manual Talos configuration required
- Two installation modes: pre-installed template or ISO-based installation
- For template-based deployment: A Talos VM template with Talos pre-installed (see documentation)
- For ISO-based installation: A Talos ISO uploaded to Xen Orchestra and a minimal VM template (
Generic Linux UEFI) - Xen Orchestra API token
- Terraform installed
- A network with DHCP configured in your Xen Orchestra environment
- Copy the example configuration:
cp terraform.tfvars.example terraform.tfvars- Edit
terraform.tfvarswith your Xen Orchestra and cluster details:
xoa_token = "<your_xen_orchestra_api_token>"
xoa_url = "https://your-xoa-server.example.com"
tpl_talos_id = "<talos_template_id>"
pool_name = "<pool_name_label>"
sr_name = "<shared_storage_name_label>"
network_name = "<network_name_label>"
expected_ip_cidr = "10.1.0.0/16"
cluster_name = "demo-talos"
cluster_vip = "10.1.0.10" # Virtual IP for the cluster endpoint
talos_version = "v1.11.5" # Talos version to install (used with ISO-based installation)
# Optional: customize node sizing
num_control_plane = 3
num_workers = 2- Initialize and apply:
terraform init
terraform plan
terraform apply- Retrieve cluster credentials:
terraform output -raw talosconfig > ~/.talos/config
terraform output -raw kubeconfig > ~/.kube/config
export TALOSCONFIG=~/.talos/config
export KUBECONFIG=~/.kube/config- Verify the cluster:
# Check cluster health
talosctl health
# Check nodes
kubectl get nodes -o wideThis example supports two installation modes:
1. Template-based deployment
Uses a pre-installed Talos VM template. This is the default mode when iso_name is not specified.
# In terraform.tfvars - no iso_name variable needed
tpl_talos_id = "<talos_template_id>"2. ISO-based installation
Mounts a Talos ISO and installs Talos to disk during provisioning. Useful for:
- Installing specific Talos versions
- Custom installation images
- Environments without pre-built templates
# In terraform.tfvars
tpl_talos_id = "<minimal_vm_template_id>" # Any UEFI template (recommended: `Generic Linux UEFI`)
iso_name = "talos-nocloud-amd64.iso" # ISO name in Xen Orchestra
talos_version = "v1.11.5" # Talos version to installWhen iso_name is provided:
- The ISO is mounted on all VMs via CDROM
- Installation configuration is added to Talos machine configs
- VMs will install Talos to
/dev/xvdaon first boot - Installer image uses the specified
talos_versionwith factory imagefactory.talos.dev/nocloud-installer/53b20d86399013eadfd44ee49804c1fef069bfdee3b43f3f3f5a2f57c03338ac
The cluster_endpoint variable defaults to https://<cluster_vip>:6443 if not explicitly set. You can override it if needed:
cluster_endpoint = "https://talos.example.com:6443"The example configures a VIP on the control plane nodes' first network interface (enX0) using DHCP, ensuring high availability of the Kubernetes API endpoint.