This utility automates the generation of Talos OS machine configuration files, including integration with Flux AIO for GitOps bootstrapping.
- Generates Talos machine configs for control plane and worker nodes (CPU/GPU).
- Supports custom patches via templates for advanced configuration.
- Integrates Flux AIO for GitOps.
- Validates generated configs using
talosctl. - Uses environment variables and a config file for flexible cluster setup.
- Talosctl installed and in your
$PATH.
-
Configure your cluster variables
Edit
vars.confto set cluster name, endpoint, Talos/Kubernetes versions, etc. -
Customize templates
- Control plane:
templates/talos-controlplane.tpl - Worker CPU:
templates/talos-worker-mc-cpu.tpl - Worker GPU:
templates/talos-worker-mc-gpu.tpl - Flux:
templates/flux.tpl
- Control plane:
-
Run the script
./script.sh
The script will:
- Process all templates with
envsubst - Generate Talos secrets (
secrets.yaml) - Generate configs for control plane and worker nodes
- Validate all generated configs
- Process all templates with
-
Output
Generated files:
controlplane-1.yaml,controlplane-2.yaml,controlplane-3.yamlworker-cpu.yaml,worker-gpu.yamlsecrets.yamltalosconfigflux.yaml
=== Talos Cluster Configuration Generator ===
Cluster:
==========================================
Processing template files...
Processed: templates/flux.tpl -> output/flux.yaml
Processed: templates/talos-controlplane.tpl -> output/talos-controlplane.yaml
Processed: templates/talos-worker-mc-cpu.tpl -> output/talos-worker-mc-cpu.yaml
Processed: templates/talos-worker-mc-gpu.tpl -> output/talos-worker-mc-gpu.yaml
Generating Talos secrets...
Talos secrets generated successfully: secrets.yaml
Generating Talos cluster configuration...
Generating control plane configurations...
Generating control plane 1: controlplane-1.yaml
Running: talosctl gen config test-cluster-53699ddb9960 https://172.20.0.1 --config-patch-control-plane @output/talos-controlplane.yaml --config-patch-control-plane @output/flux.yaml --config-patch '[{"op": "add", "path": "/machine/network/hostname", "value": "io-control-plane-1"}]' --with-secrets secrets.yaml --with-docs=false --with-examples=false --kubernetes-version "1.33.2" --talos-version "v1.10.7" -t controlplane -o controlplane-1.yaml -f
generating PKI and tokens
Created controlplane-1.yaml
Control plane 1 configuration generated: controlplane-1.yaml
Generating control plane 2: controlplane-2.yaml
Running: talosctl gen config test-cluster-53699ddb9960 https://172.20.0.1 --config-patch-control-plane @output/talos-controlplane.yaml --config-patch '[{"op": "add", "path": "/machine/network/hostname", "value": "io-control-plane-2"}]' --with-secrets secrets.yaml --with-docs=false --with-examples=false --kubernetes-version "1.33.2" --talos-version "v1.10.7" -t controlplane -o controlplane-2.yaml -f
generating PKI and tokens
Created controlplane-2.yaml
Control plane 2 configuration generated: controlplane-2.yaml
Generating control plane 3: controlplane-3.yaml
Running: talosctl gen config test-cluster-53699ddb9960 https://172.20.0.1 --config-patch-control-plane @output/talos-controlplane.yaml --config-patch '[{"op": "add", "path": "/machine/network/hostname", "value": "io-control-plane-3"}]' --with-secrets secrets.yaml --with-docs=false --with-examples=false --kubernetes-version "1.33.2" --talos-version "v1.10.7" -t controlplane -o controlplane-3.yaml -f
generating PKI and tokens
Created controlplane-3.yaml
Control plane 3 configuration generated: controlplane-3.yaml
Generating worker CPU configuration...
Running: talosctl gen config test-cluster-53699ddb9960 https://172.20.0.1 --config-patch-worker @output/talos-worker-mc-cpu.yaml --with-secrets secrets.yaml --with-docs=false --with-examples=false --kubernetes-version "1.33.2" --talos-version "v1.10.7" -t worker -o worker-cpu.yaml -f
generating PKI and tokens
Created worker-cpu.yaml
Worker CPU configuration generated: worker-cpu.yaml
Generating worker GPU configuration...
Running: talosctl gen config test-cluster-53699ddb9960 https://172.20.0.1 --config-patch-worker @output/talos-worker-mc-gpu.yaml --with-secrets secrets.yaml --with-docs=false --with-examples=false --kubernetes-version "1.33.2" --talos-version "v1.10.7" -t worker -o worker-gpu.yaml -f
generating PKI and tokens
Created worker-gpu.yaml
Worker GPU configuration generated: worker-gpu.yaml
Generating talosconfig...
Running: talosctl gen config test-cluster-53699ddb9960 https://172.20.0.1 --with-secrets secrets.yaml --with-docs=false --with-examples=false --kubernetes-version "1.33.2" --talos-version "v1.10.7" -t talosconfig -o talosconfig -f
generating PKI and tokens
Created talosconfig
Talosconfig generated: talosconfig
==========================================
All Talos configurations generated successfully:
Control Planes:
- controlplane-1.yaml
- controlplane-2.yaml
- controlplane-3.yaml
Workers:
- worker-cpu.yaml
- worker-gpu.yaml
Config:
- talosconfig
==========================================
\nValidating generated Talos configuration files...
Validating controlplane-1.yaml...
controlplane-1.yaml is valid for metal mode
Validating controlplane-2.yaml...
controlplane-2.yaml is valid for metal mode
Validating controlplane-3.yaml...
controlplane-3.yaml is valid for metal mode
Validating worker-cpu.yaml...
worker-cpu.yaml is valid for metal mode
Validating worker-gpu.yaml...
worker-gpu.yaml is valid for metal mode
All configuration files validated successfully.
==========================================
Configuration generation completed!
Cluster Name: test-cluster-53699ddb9960
Cluster Endpoint: https://172.20.0.1
==========================================