add enable-kubelet on second boot

This commit is contained in:
Steven Polley 2023-12-18 18:27:58 -07:00
parent a4ea60d253
commit 95da8be91b

View File

@ -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