clone k8s repo to control nodes at first boot

This commit is contained in:
Steven Polley 2023-12-21 12:39:48 -07:00
parent abf8ea60af
commit d36d966970

View File

@ -48,13 +48,19 @@ storage:
net.bridge.bridge-nf-call-iptables=1
net.ipv4.ip_forward=1
# Runs on first boot, script to install kubelet dependencies
- path: /usr/local/bin/install-kubelet.sh
- path: /usr/local/bin/first-boot.sh
mode: 0744
overwrite: true
contents:
inline: |
#!/bin/bash
rpm-ostree install kubelet kubeadm kubectl cri-o vim etcd
# Control plane node hook
if [[ $(hostname) = *control* ]]; then
git clone https://deadbeef.codes/steven/deadbeef.codes-k8s.git /home/steven/
chown -R steven:steven /home/steven/deadbeef.codes-k8s
fi
systemctl reboot
- path: /home/steven/cluster-config.yaml
mode: 0600
@ -94,37 +100,37 @@ passwd: # setting login credentials
groups: [ sudo, docker ]
systemd:
units:
- name: install-kubelet.service
- name: first-boot.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/first-boot
[Service]
Type=oneshot
ExecStart=/usr/local/bin/install-kubelet.sh
ExecStartPost=/usr/bin/touch /var/lib/install-kubelet
ExecStart=/usr/local/bin/first-boot.sh
ExecStartPost=/usr/bin/touch /var/lib/first-boot
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
- name: enable-kubelet.service
- name: second-boot.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
ConditionPathExists=/var/lib/first-boot
ConditionPathExists=!/var/lib/second-boot
[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl enable --now crio kubelet
ExecStartPost=/usr/bin/touch /var/lib/enable-kubelet
ExecStartPost=/usr/bin/touch /var/lib/second-boot
RemainAfterExit=yes
[Install]