Automating k3s Deployments Using k3OS Immutable Configuration
Learn how k3OS uses an immutable root filesystem and a dedicated config partition to automate k3s cluster deployments and eliminate configuration drift.
21 Jan 2026, 13:01 UTC

The Problem: Configuration Drift in Edge Clusters
Managing Kubernetes at the edge often leads to "snowflake" nodes—servers where manual tweaks, package updates, and configuration drift make scaling and recovery unpredictable. When a node fails, recreating its exact state from a general-purpose Linux installation is time-consuming and error-prone.
The solution is to decouple the operating system from the cluster configuration. k3OS achieves this by using an immutable root filesystem paired with a dedicated, writable config partition. This ensures the OS remains a read-only appliance, while the cluster identity and settings are injected via YAML files during the boot process.
How the Boot-to-Cluster Mechanism Works
k3OS is designed specifically to run k3s. Rather than using a traditional installer, it utilizes a specialized init process that scans a FAT32 partition (typically mounted at /mnt/config) before the k3s service starts. If the init process finds valid YAML configurations, it applies them to the k3s agent or server automatically.
This architecture allows you to use a single, generic OS image across your entire fleet. The role of the node—whether it acts as a control-plane server or a worker agent—is determined solely by the files present on the config partition.
Worked Example: Configuring a k3s Agent
To join a node to an existing cluster, you do not run curl scripts or manual systemctl commands. Instead, you place a k3s.yaml file on the config partition. This file must be present before the first boot or applied via a separate disk image or USB drive.
# Example k3s.yaml for a worker node
# Location: /mnt/config/k3s.yaml
k3s:
agent:
# The IP address of the first server in the cluster
server: https://192.168.1.10:6443
# The shared secret token found on the server at
# /var/lib/rancher/k3s/server/node-token
token: K10abc123def456ghi789jkl
# Optional: Custom node name to avoid random hostnames
node-name: edge-worker-01
Deployment and Verification
- Provisioning: Flash the k3OS image to the target drive.
- Injection: Mount the config partition (FAT32) from a separate workstation and write the
k3s.yamlfile. - Execution: Boot the node. The init process reads
/mnt/config/k3s.yamland passes these arguments to the k3s binary.
To verify the node has successfully joined the cluster, run the following command from a machine with kubectl access to the cluster:
# Run on a control-plane node or admin workstation
kubectl get nodesExpected Result: The node-name specified in the YAML (e.g., edge-worker-01) should appear in the list with a status of Ready.
Limitations and Engineering Trade-offs
While the immutable design increases reliability, it introduces specific constraints that engineers must account for:
- No Persistent Host Packages: Because the root filesystem is read-only, you cannot use
aptoryumto install monitoring agents or utilities. Any required tooling must be deployed as a Kubernetes DaemonSet. - Boot-Loop Risks: If the
k3s.yamlcontains syntax errors or invalid IP addresses, the k3s service may fail to start. Depending on the version, this can lead to a boot loop or a node that is powered on but unreachable via the Kubernetes API. - Limited Local Debugging: Standard Linux troubleshooting tools are stripped to reduce the attack surface. If the cluster fails to initialize, you must use a rescue shell or access the logs via the serial console.
Common Mistakes
| Mistake | Consequence | Correction |
|---|---|---|
| Editing files in /etc/ directly | Changes are lost upon reboot | Place configuration in /mnt/config/k3s.yaml |
| Using an incompatible partition format | Init process cannot read config | Ensure the config partition is formatted as FAT32 |
| Hardcoding tokens in public images | Security vulnerability | Inject the k3s.yaml during deployment, not inside the base OS image |
Rollback Procedure: To revert a configuration change or remove a node from the cluster, delete the k3s.yaml file from the config partition and reboot the system. This returns the node to an unconfigured state.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.