initial scaffold
This commit is contained in:
commit
5c2080a73b
31 changed files with 1244 additions and 0 deletions
33
terraform/cloud-init/agent.yaml.tpl
Normal file
33
terraform/cloud-init/agent.yaml.tpl
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#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
|
||||
8
terraform/cloud-init/network-config.yaml.tpl
Normal file
8
terraform/cloud-init/network-config.yaml.tpl
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
version: 2
|
||||
ethernets:
|
||||
eth0:
|
||||
addresses:
|
||||
- ${ip}/${prefix_length}
|
||||
gateway4: ${gateway}
|
||||
nameservers:
|
||||
addresses: [${gateway}]
|
||||
30
terraform/cloud-init/server.yaml.tpl
Normal file
30
terraform/cloud-init/server.yaml.tpl
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#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: /etc/rancher/k3s/config.yaml
|
||||
permissions: '0600'
|
||||
content: |
|
||||
token: "${k3s_token}"
|
||||
tls-san:
|
||||
- "${hostname}"
|
||||
- "${k8s_api_hostname}"
|
||||
|
||||
runcmd:
|
||||
- curl -sfL https://get.k3s.io | sh -s - server
|
||||
- mkdir -p /home/k3s/.kube
|
||||
- k3s kubectl config view --raw > /home/k3s/.kube/config
|
||||
- chown -R k3s:k3s /home/k3s/.kube
|
||||
Loading…
Add table
Add a link
Reference in a new issue