Component Overview
machined
machined is the heart of Talos Linux - the system controller that manages the entire node lifecycle.
Responsibilities
- Boot orchestration - Executes boot sequence tasks in order
- Service management - Starts, stops, and monitors system services
- Configuration management - Applies and validates machine config
- Controller runtime - Runs COSI controllers for state reconciliation
- API implementation - Implements the Machine Service API
- Event system - Publishes system events for monitoring
Implementation Details
Frominternal/app/machined/pkg/system/services/machined.go:34:
machined runs as a goroutine (not in a container) and exposes a Unix socket at /run/machined/machined.sock with restricted permissions:
- Socket owned by
apiduser for secure access - SELinux label applied for additional isolation
- RBAC enforced at the API layer
Service Management
Services are managed through a dependency graph defined by theDependsOn() interface. For example:
containerdhas no dependencies (starts first)apiddepends oncontainerdkubeletdepends oncri(containerd CRI plugin)etcddepends oncri
Health Checking
Services implementingHealthcheckedService are continuously monitored:
apid
apid is the public-facing API server that handles all external communication with Talos nodes.
Responsibilities
- API gateway - Exposes gRPC services on port 50000
- Authentication - Validates client certificates (mTLS)
- Authorization - Enforces role-based access control
- Request proxying - Forwards requests to
machinedvia Unix socket - Multi-node operations - Can proxy requests to other cluster members
Implementation Details
Frominternal/app/machined/pkg/system/services/apid.go:46:
apid runs as a containerized service with:
- Minimal privileges - All capabilities dropped except necessary ones
- Network namespace - Shares host network for API access
- Read-only root - Container filesystem is immutable
- Resource limits - Memory limit via
GOMEMLIMITenvironment variable
Resource Filtering
Frominternal/app/machined/pkg/system/services/apid.go:57-74, apid has filtered access to the COSI state:
apid can only access its own certificates and network information, following the principle of least privilege.
API Ports
| Port | Service | Purpose |
|---|---|---|
| 50000 | apid | Main Talos API (gRPC) |
| 50001 | trustd | Certificate signing (mTLS) |
trustd
trustd is Talos’s built-in certificate authority that handles PKI operations for the cluster.
Responsibilities
- Certificate authority - Signs certificate requests for cluster components
- Token validation - Validates bootstrap tokens for new nodes
- Certificate issuance - Issues certificates for nodes joining the cluster
- Root of trust - Maintains the cluster CA and root certificates
Implementation Details
Frominternal/app/machined/pkg/system/services/trustd.go:43-54:
trustd runs as a containerized service with strict isolation:
- Minimal capabilities - All capabilities dropped
- User ID isolation - Runs as dedicated
trustduser - Filtered resource access - Only accesses secrets in
secrets.TrustdType - Time synchronization dependency - Waits for NTP sync before starting
Bootstrap Flow
When a new node joins:- Node generates ephemeral key pair
- Connects to
trustdwith bootstrap token trustdvalidates token and issues certificates- Node uses certificates for all future API calls
containerd
Talos uses containerd as its container runtime for both system services and Kubernetes workloads.Responsibilities
- Container lifecycle - Start, stop, and manage containers
- Image management - Pull and store container images
- CRI implementation - Provides CRI interface for kubelet
- Namespace isolation - Separates system containers from Kubernetes pods
Implementation Details
Frominternal/app/machined/pkg/system/services/containerd.go:87-100:
Namespaces
Talos uses containerd namespaces to separate concerns:system- Talos system services (apid, trustd, etcd)k8s.io- Kubernetes pods and containers
Socket Locations
- System containerd:
/run/containerd/containerd.sock - CRI containerd:
/run/containerd/containerd.sock(same instance, different namespace)
Health Checking
containerd health is verified through its gRPC health service:kubelet
The kubelet runs as a system container managed by Talos, connecting the node to the Kubernetes cluster.Implementation Details
Frominternal/app/machined/pkg/system/services/kubelet.go:128-215:
The kubelet runs with extensive privileges required for pod management:
- Host networking - Shares host network namespace
- Host PID namespace - Can see host processes
- Device access - Full access to
/dev - Shared mount propagation - Required for volume mounts
- Most capabilities - Needs elevated permissions for container operations
Key Mounts
/etc/kubernetes- Kubelet config and credentials/var/lib/kubelet- Pod data and volumes/var/lib/containerd- Container runtime state/sys/fs/cgroup- cgroup management/dev- Device access for volumes
Health Check
Kubelet health is checked via its healthz endpoint:etcd
etcd runs on control plane nodes only, providing distributed consensus for Kubernetes.Implementation Details
Frominternal/app/machined/pkg/system/services/etcd.go:60-78:
Cluster Membership
Talos manages etcd cluster membership automatically:- Init node: Starts with
initial-cluster-state=new - Joining nodes: Added as learners first, then promoted to voting members
- Member removal: Graceful shutdown removes member from cluster
- Learner promotion: Automatic after member catches up with leader
Storage
etcd data is stored on theEPHEMERAL partition at /var/lib/etcd:
- Data persists across reboots
- Wiped during reset operations
- Backed up via snapshot mechanism
High Availability
Frominternal/app/machined/pkg/system/services/etcd.go:588-631, Talos handles learner member promotion:
System Services
Talos includes minimal system services for basic operations:udevd
Device manager for hardware events:- Detects new hardware
- Creates device nodes in
/dev - Triggers loading of kernel modules
syslogd
Minimal logging daemon:- Receives kernel logs
- Routes to appropriate destinations
- No persistent logs (logs go to memory buffer)
registryd
Manages system extensions and image overlays:- Loads system extensions from configured sources
- Manages extension lifecycle
- Provides extension metadata
Unlike traditional Linux distributions, Talos services are designed to be ephemeral and stateless where possible.
Service Runner Types
Talos uses different runner types for different service needs:Process Runner
Runs services as host processes (e.g., containerd):- Direct execution on host
- Managed by machined
- Restart policies applied
Containerd Runner
Runs services in containers (e.g., kubelet, etcd, apid):- OCI spec generated dynamically
- Namespace isolation
- Resource limits enforced
Goroutine Runner
Runs services as Go goroutines (e.g., machined internal services):- Lightweight
- Shared memory space
- Fast startup
Resource Management
All services have resource constraints:- OOM scores: Critical services get negative scores to avoid OOM kills
containerd: -999 (most protected)apid,trustd: -998kubelet: -996
- Memory limits: Set via
GOMEMLIMITfor Go services - Cgroup paths: Each service in its own cgroup for isolation
Next Steps
Security Model
Learn how these components are secured
Networking
Understand network architecture