cluster/configs/workers/k3s-flatcar.yaml

73 lines
2.5 KiB
YAML

variant: flatcar
version: 1.1.0
systemd:
units:
- name: containerd.service
enabled: false
dropins:
- name: 10-use-custom-config.conf
contents: |
[Service]
ExecStart=
ExecStart=/usr/bin/containerd
- name: spin-shim-install.service
enabled: true
contents: |
[Unit]
Description=Run Spin Shim script
Wants = network-online.target
After = network.target network-online.target
StartLimitBurst=100
StartLimitIntervalSec=300
ConditionPathExists=!/var/lib/rancher/k3s/data/current/bin/containerd-shim-spin-v2
[Service]
Type=oneshot
TimeoutStartSec=300
RemainAfterExit=yes
KillMode=process
ExecStart=/usr/bin/bash -c "until [ -d /var/lib/rancher/k3s/data/current/bin ]; do sleep 5; done; curl -L https://github.com/spinkube/containerd-shim-spin/releases/download/${spin_shim_version}/containerd-shim-spin-v2-linux-${arch}.tar.gz | tar -xz -C /var/lib/rancher/k3s/data/current/bin/"
[Install]
WantedBy=multi-user.target
- name: k3s-install.service
enabled: true
contents: |
[Unit]
Description=Run K3s script
Wants = network-online.target
After = network.target network-online.target
ConditionPathExists=/opt/k3s-install.sh
ConditionPathExists=!/opt/bin/k3s
[Service]
Type=forking
TimeoutStartSec=180
RemainAfterExit=yes
KillMode=process
Environment="K3S_URL=https://172.23.2.10:6443"
Environment="K3S_TOKEN=${k3s_token}"
Environment="INSTALL_K3S_VERSION=${k3s_version}"
Environment="INSTALL_K3S_EXEC=agent --node-ip=${node_ip} --kubelet-arg --cloud-provider=external --node-label k8s.icb4dc0.de/storage-node=${tostring(storage_node)}"
ExecStart=/usr/bin/sh -c "/opt/k3s-install.sh"
[Install]
WantedBy=multi-user.target
storage:
files:
- path: /etc/hostname
mode: 0644
contents:
inline: ${host}
- path: /opt/k3s-install.sh
mode: 0777
contents:
source: https://get.k3s.io
- path: /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl
mode: 0644
contents:
inline: |
{{- template "base" . }}
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.spin]
runtime_type = "io.containerd.spin.v2"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.spin.options]
BinaryName = "/opt/bin/containerd-shim-spin-v2"