Skip to content

Instantly share code, notes, and snippets.

@siegy22
Last active August 19, 2024 05:34
Show Gist options
  • Save siegy22/a981aaf67f7310f558eee8b82300f3df to your computer and use it in GitHub Desktop.
Save siegy22/a981aaf67f7310f558eee8b82300f3df to your computer and use it in GitHub Desktop.
Fedora CoreOS k3s ignition

Installing k3s on Fedora CoreOS

Use the templates to provision your k3s instances on Fedora CoreOS using ignition. This will install k3s-selinux with rpm-ostree.

variant: fcos
version: 1.5.0
systemd:
units:
- name: k3s-installer.service
enabled: true
contents: |
[Unit]
After=network-online.target
Wants=network-online.target
Before=systemd-user-sessions.service
OnFailure=emergency.target
OnFailureJobMode=replace-irreversibly
ConditionPathExists=!/var/lib/rancher/k3s
[Service]
RemainAfterExit=yes
Type=oneshot
ExecStart=/usr/local/bin/run-k3s-installer
ExecStartPost=/usr/bin/systemctl --no-block reboot
StandardOutput=kmsg+console
StandardError=kmsg+console
[Install]
WantedBy=multi-user.target
storage:
files:
- path: /usr/local/bin/run-k3s-installer
mode: 0755
contents:
inline: |
#!/usr/bin/env sh
main() {
export K3S_TOKEN=SECRET # Please replace this.
curl -sfL https://get.k3s.io | sh - server --cluster-init
return 0
}
main
variant: fcos
version: 1.5.0
systemd:
units:
- name: k3s-installer.service
enabled: true
contents: |
[Unit]
After=network-online.target
Wants=network-online.target
Before=systemd-user-sessions.service
OnFailure=emergency.target
OnFailureJobMode=replace-irreversibly
ConditionPathExists=!/var/lib/rancher/k3s
[Service]
RemainAfterExit=yes
Type=oneshot
ExecStart=/usr/local/bin/run-k3s-installer
ExecStartPost=/usr/bin/systemctl --no-block reboot
StandardOutput=kmsg+console
StandardError=kmsg+console
[Install]
WantedBy=multi-user.target
storage:
files:
- path: /usr/local/bin/run-k3s-installer
mode: 0755
contents:
inline: |
#!/usr/bin/env sh
main() {
export K3S_TOKEN=SECRET # Please replace this.
curl -sfL https://get.k3s.io | sh -s - server --server https://<ip or hostname of bootstrap>:6443
return 0
}
main
variant: fcos
version: 1.5.0
systemd:
units:
- name: k3s-installer.service
enabled: true
contents: |
[Unit]
After=network-online.target
Wants=network-online.target
Before=systemd-user-sessions.service
OnFailure=emergency.target
OnFailureJobMode=replace-irreversibly
ConditionPathExists=!/var/lib/rancher/k3s
[Service]
RemainAfterExit=yes
Type=oneshot
ExecStart=/usr/local/bin/run-k3s-installer
ExecStartPost=/usr/bin/systemctl --no-block reboot
StandardOutput=kmsg+console
StandardError=kmsg+console
[Install]
WantedBy=multi-user.target
storage:
files:
- path: /usr/local/bin/run-k3s-installer
mode: 0755
contents:
inline: |
#!/usr/bin/env sh
main() {
export K3S_TOKEN=SECRET # Please replace this.
curl -sfL https://get.k3s.io | sh -s - agent --server https://<ip or hostname of your kubernetes API>:6443
return 0
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment