variant: flatcar version: 1.1.0 systemd: units: - name: litestream.service enabled: true contents: | [Unit] Description=Litestream [Service] Restart=always TimeoutSec=1800 TimeoutStartSec=180 ExecStartPre=/bin/bash -c "mkdir -p /opt/litestream && curl -L https://github.com/benbjohnson/litestream/releases/download/${litestream_version}/litestream-${litestream_version}-linux-arm64.tar.gz | tar -xvz -C /opt/litestream/" ExecStartPre=/opt/litestream/litestream restore -replica s3 -if-db-not-exists -if-replica-exists /var/lib/rancher/k3s/server/db/state.db ExecStart=/opt/litestream/litestream replicate [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 litestream.service ConditionPathExists=/opt/k3s-install.sh ConditionPathExists=!/opt/k3s/bin/k3s [Service] Type=forking Restart=always TimeoutSec=1800 TimeoutStartSec=120 ExecStartPre=-/sbin/modprobe br_netfilter ExecStartPre=-/sbin/modprobe overlay ExecStartPre=mkdir -p /opt/k3s LimitNOFILE=1048576 LimitNPROC=infinity LimitCORE=infinity TasksMax=infinity TimeoutStartSec=180 RemainAfterExit=yes KillMode=process Environment="K3S_TOKEN=${k3s_token}" Environment="INSTALL_K3S_VERSION=${k3s_version}" Environment="INSTALL_K3S_BIN_DIR=/opt/k3s" Environment="INSTALL_K3S_EXEC=server --data-dir /var/lib/rancher/k3s --advertise-address 172.23.2.10 --node-ip ${node_ip} --node-taint=node-type=k3s-controlplane:NoSchedule %{for san in k3s_sans }--tls-san='${san}' %{endfor} --disable-cloud-controller --disable servicelb --kubelet-arg=cloud-provider=external" 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: /etc/litestream.yml mode: 0644 contents: source: data:;base64,${litestream_config}