cloud-demo/terraform/cloud-init/agent.yaml.tpl
CodeGit 5c2080a73b
Some checks failed
terraform / validate (push) Waiting to run
build-hello-app / build-and-push (push) Has been cancelled
initial scaffold
2026-08-18 20:22:42 +01:00

33 lines
758 B
Smarty

#cloud-config
hostname: ${hostname}
manage_etc_hosts: true
users:
- name: k3s
groups: sudo
shell: /bin/bash
sudo: ALL=(ALL) NOPASSWD:ALL
ssh_authorized_keys:
- ${ssh_public_key}
package_update: true
packages:
- curl
write_files:
- path: /usr/local/bin/join-k3s.sh
permissions: '0755'
content: |
#!/bin/sh
# Server may still be booting; retry the join until it answers.
until curl -sk https://${server_ip}:6443/ping >/dev/null 2>&1; do
echo "waiting for k3s server at ${server_ip}..."
sleep 5
done
curl -sfL https://get.k3s.io | \
K3S_URL="https://${server_ip}:6443" \
K3S_TOKEN="${k3s_token}" \
sh -s - agent
runcmd:
- /usr/local/bin/join-k3s.sh