The Talos Operator manages Talos Linux Kubernetes clusters through declarative Custom Resource Definitions. It automates cluster lifecycle management by reconciling KubernetesCluster resources and generating the necessary Machine resources for cluster topology deployment.
Architecture
Controller Structure
The operator implements a single primary controller:
The primary resource managed by the Talos Operator:
apiVersion:vitistack.io/v1alpha1kind:KubernetesClustermetadata:name:string# Cluster identifiernamespace:string# Kubernetes namespacefinalizers:-cluster.vitistack.io/finalizer# Cleanup finalizerspec:# Cluster ConfigurationclusterName:string# Talos cluster namekubernetesVersion:string# Kubernetes version (e.g., "v1.28.3")talosVersion:string# Talos Linux version (e.g., "v1.5.5")# Network ConfigurationclusterEndpoint:string# Kubernetes API server endpointpodSubnets:[]string# Pod CIDR rangesserviceSubnets:[]string# Service CIDR ranges# Node TopologycontrolPlane:replicas:int# Number of control plane nodes (1, 3, 5)machineTemplate:# Template for control plane machinesspec:MachineSpec# Machine specificationworkers:-name:string# Worker group namereplicas:int# Number of worker nodesmachineTemplate:# Template for worker machinesspec:MachineSpec# Machine specification# Talos ConfigurationtalosConfig:# Machine Configurationmachine:type:string# Machine type: controlplane, workertoken:string# Bootstrap tokenca:# Certificate authority configurationcrt:string# CA certificatekey:string# CA private keycertSANs:[]string# Certificate subject alternative names# Cluster Configuration cluster:name:string# Cluster namecontrolPlane:endpoint:string# Control plane endpointnetwork:dnsDomain:string# Cluster DNS domain (default: cluster.local)podSubnets:[]string# Pod CIDR rangesserviceSubnets:[]string# Service CIDR ranges# Installation Configurationinstall:disk:string# Installation disk (e.g., "/dev/sda")image:string# Talos system imagebootloader:bool# Install bootloaderwipe:bool# Wipe disk before installationstatus:phase:string# Current phase: Pending, Provisioning, Running, Failedconditions:[]Condition# Status conditionscontrolPlaneReady:bool# Control plane readinessworkersReady:int# Number of ready worker nodesmachineCount:int# Total generated machinesobservedGeneration:int# Last observed resource generationlastUpdated:string# Last reconciliation timestamp
Generated Machine Resources
The operator generates Machine resources with the following structure:
apiVersion:vitistack.io/v1alpha1kind:Machinemetadata:name:string# Generated machine namenamespace:string# Inherited from KubernetesClusterlabels:cluster.vitistack.io/cluster-name:string# Cluster referencecluster.vitistack.io/role:string# Node role: controlplane, workercluster.vitistack.io/worker-group:string# Worker group name (workers only)ownerReferences:-apiVersion:vitistack.io/v1alpha1kind:KubernetesClustername:string# Parent cluster nameuid:string# Parent cluster UIDspec:# Inherited from machineTemplate in KubernetesCluster# Machine-specific configuration based on role and template# Talos-specific additionstalosConfig:machineType:string# controlplane or workerclusterEndpoint:string# Kubernetes API endpointinstallDisk:string# Target installation disk
Configuration Reference
Environment Variables
Variable
Type
Default
Description
KUBEBUILDER_ASSETS
string
-
Path to Kubebuilder test binaries
RECONCILE_INTERVAL
duration
30s
KubernetesCluster reconciliation interval
MAX_CONCURRENT_RECONCILES
int
1
Maximum concurrent reconciliations
METRICS_BIND_ADDRESS
string
:8080
Metrics server bind address
HEALTH_PROBE_BIND_ADDRESS
string
:8081
Health probe bind address
RESULTS_PATH
string
hack/results
Path for generated machine manifests
Talos Configuration Parameters
Machine Configuration
Parameter
Type
Required
Description
machine.type
string
Yes
Machine type: controlplane or worker
machine.token
string
Yes
Bootstrap token for cluster joining
machine.ca.crt
string
Yes
Certificate Authority certificate
machine.ca.key
string
Yes
Certificate Authority private key
machine.certSANs
[]string
No
Additional certificate SANs
machine.kubelet.image
string
No
Kubelet container image
machine.kubelet.extraArgs
map[string]string
No
Additional kubelet arguments
Cluster Configuration
Parameter
Type
Default
Description
cluster.name
string
-
Cluster identifier
cluster.controlPlane.endpoint
string
-
Kubernetes API server endpoint
cluster.network.dnsDomain
string
cluster.local
Cluster DNS domain
cluster.network.podSubnets
[]string
["10.244.0.0/16"]
Pod CIDR ranges
cluster.network.serviceSubnets
[]string
["10.96.0.0/12"]
Service CIDR ranges
Installation Configuration
Parameter
Type
Default
Description
install.disk
string
/dev/sda
Target installation disk
install.image
string
-
Talos system image URL
install.bootloader
bool
true
Install bootloader
install.wipe
bool
false
Wipe disk before installation
install.extraKernelArgs
[]string
-
Additional kernel arguments
Operational Reference
Reconciliation Workflow
The KubernetesCluster controller implements the following reconciliation logic:
File Generation: Saves machine manifests to hack/results/{cluster-name}/
Owner Reference: Sets KubernetesCluster as owner for automatic cleanup
Status Update: Reports cluster status and machine count
Deletion Handling: Cleans up machines and generated files on deletion
Machine Naming Conventions
Node Type
Naming Pattern
Example
Control Plane
{cluster-name}-cp-{index}
prod-cluster-cp-0
Worker
{cluster-name}-{worker-group}-{index}
prod-cluster-workers-0
Index starts from 0 and increments based on replica count.
File System Operations
Generated Manifest Structure
hack/results/{cluster-name}/
├── {cluster-name}-cp-0.yaml # Control plane machine 0
├── {cluster-name}-cp-1.yaml # Control plane machine 1
├── {cluster-name}-cp-2.yaml # Control plane machine 2
├── {cluster-name}-workers-0.yaml # Worker group machine 0
├── {cluster-name}-workers-1.yaml # Worker group machine 1
└── {cluster-name}-custom-0.yaml # Custom worker group machine 0
File Operations
Operation
Trigger
Behavior
Create
New KubernetesCluster
Generate all machine manifests
Update
Spec change
Regenerate affected machine manifests
Delete
Resource deletion
Remove all cluster manifest files
Processing Specifications
Cluster Topology Processing
Control Plane Generation
fori:=0;i<spec.ControlPlane.Replicas;i++{machine:=&Machine{ObjectMeta:metav1.ObjectMeta{Name:fmt.Sprintf("%s-cp-%d",clusterName,i),Namespace:cluster.Namespace,Labels:map[string]string{"cluster.vitistack.io/cluster-name":clusterName,"cluster.vitistack.io/role":"controlplane",},},Spec:spec.ControlPlane.MachineTemplate.Spec,}// Set owner reference and create machine}
Worker Group Generation
for_,workerGroup:=rangespec.Workers{fori:=0;i<workerGroup.Replicas;i++{machine:=&Machine{ObjectMeta:metav1.ObjectMeta{Name:fmt.Sprintf("%s-%s-%d",clusterName,workerGroup.Name,i),Namespace:cluster.Namespace,Labels:map[string]string{"cluster.vitistack.io/cluster-name":clusterName,"cluster.vitistack.io/role":"worker","cluster.vitistack.io/worker-group":workerGroup.Name,},},Spec:workerGroup.MachineTemplate.Spec,}// Set owner reference and create machine}}
Talos Configuration Generation
Machine Type Mapping
KubernetesCluster Role
Talos Machine Type
Configuration
controlPlane
controlplane
API server, etcd, scheduler, controller-manager
workers[].name
worker
Kubelet, container runtime
Network Configuration Processing
# From KubernetesCluster specspec:podSubnets:["10.244.0.0/16"]serviceSubnets:["10.96.0.0/12"]# Generated in Machine talosConfigcluster:network:podSubnets:["10.244.0.0/16"]serviceSubnets:["10.96.0.0/12"]
# Deploy using Makefile
makedeployIMG=ghcr.io/vitistack/talos-operator:latest
Example Configurations
Simple Cluster
apiVersion:vitistack.io/v1alpha1kind:KubernetesClustermetadata:name:simple-clusterspec:clusterName:simple-clusterkubernetesVersion:v1.28.3talosVersion:v1.5.5clusterEndpoint:https://192.168.1.100:6443controlPlane:replicas:3machineTemplate:spec:# Machine specification for control plane nodesworkers:-name:workersreplicas:2machineTemplate:spec:# Machine specification for worker nodes
Multi-Worker Group Cluster
apiVersion:vitistack.io/v1alpha1kind:KubernetesClustermetadata:name:complex-clusterspec:clusterName:complex-clusterkubernetesVersion:v1.28.3talosVersion:v1.5.5clusterEndpoint:https://192.168.1.100:6443controlPlane:replicas:3machineTemplate:spec:{}# Control plane machine specworkers:-name:general-workersreplicas:3machineTemplate:spec:{}# General worker spec-name:gpu-workersreplicas:2machineTemplate:spec:{}# GPU worker spec-name:storage-workersreplicas:1machineTemplate:spec:{}# Storage worker spec
This reference documentation provides comprehensive technical details for system administrators and developers working with the Talos Operator, assuming familiarity with Kubernetes operators, Talos Linux, and cluster-api concepts.