From 95da8be91b157653823d2538dcc7de7f758357dc Mon Sep 17 00:00:00 2001 From: Steven Polley Date: Mon, 18 Dec 2023 18:27:58 -0700 Subject: [PATCH] add enable-kubelet on second boot --- 00-provisioning/butane/full.yaml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/00-provisioning/butane/full.yaml b/00-provisioning/butane/full.yaml index 803c834..8acf689 100644 --- a/00-provisioning/butane/full.yaml +++ b/00-provisioning/butane/full.yaml @@ -47,7 +47,7 @@ storage: inline: | net.bridge.bridge-nf-call-iptables=1 net.ipv4.ip_forward=1 - # script to install kubelet dependencies + # Runs on first boot, script to install kubelet dependencies - path: /usr/local/bin/install-kubelet.sh mode: 0744 overwrite: true @@ -55,8 +55,6 @@ storage: inline: | #!/bin/bash rpm-ostree install kubelet kubeadm kubectl cri-o vim - systemctl enable crio kubelet - sleep 1 # systemctl enable and reboot race condition? systemctl reboot - path: /home/steven/cluster-config.yaml mode: 0600 @@ -112,3 +110,18 @@ systemd: [Install] WantedBy=multi-user.target + - name enable-kubelet.service + enabled: true + contents: | + [Unit] + Before=systemd-user-sessions.service + Wants=network-online.target + After=network-online.target + ConditionPathExists=/var/lib/install-kubelet + ConditionPathExists=!/var/lib/enable-kubelet + + [Service] + Type=oneshot + ExecStart=/usr/bin/systemctl enable --now crio kubelet + ExecStartPost=/usr/bin/touch /var/lib/enable-kubelet + RemainAfterExit=yes