variant: flatcar version: 1.0.0 storage: files: - path: /etc/hostname mode: 0644 contents: inline: k3s-node replace: true - path: /opt/setup-k3s.sh mode: 0755 contents: inline: | #!/bin/bash # Install K3s with minimal components curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="server \ --disable=traefik \ --disable=servicelb \ --tls-san=$(hostname -I | cut -d' ' -f1) \ --write-kubeconfig-mode=644" sh - # Create symlinks for easier access mkdir -p /root/.kube ln -sf /etc/rancher/k3s/k3s.yaml /root/.kube/config # Wait for node to be ready while ! kubectl get nodes; do sleep 5; done systemd: units: - name: k3s-setup.service enabled: true contents: | [Unit] Description=K3s Setup After=network-online.target Wants=network-online.target [Service] Type=oneshot ExecStart=/opt/setup-k3s.sh RemainAfterExit=yes [Install] WantedBy=multi-user.target