Skip to content

Instantly share code, notes, and snippets.

@dgiebert
Last active October 25, 2022 13:13
Show Gist options
  • Save dgiebert/df921961c2f174ad144e56ac6805ccb4 to your computer and use it in GitHub Desktop.
Save dgiebert/df921961c2f174ad144e56ac6805ccb4 to your computer and use it in GitHub Desktop.
#cloud-config
users:
- name: rancher
sudo: ALL=(ALL) NOPASSWD:ALL
groups: users, sudo
ssh_authorized_keys:
- ssh-ed25519 [...]
zypper:
repos:
- id: rancher-k3s-common-stable
name: Rancher K3s Common (Stable)
baseurl: https://rpm.rancher.io/k3s/stable/common/microos/noarch
enabled: 1
gpgcheck: 1
repo_gpgcheck: 0
gpgkey: https://rpm.rancher.io/public.key
write_files:
- path: /etc/rancher/k3s/config.yaml
content: |
protect-kernel-defaults: "true"
- path: /etc/sysctl.d/90-kubelet.conf
content: |
vm.panic_on_oom=0
vm.overcommit_memory=1
kernel.panic=10
kernel.panic_on_oops=1
kernel.keys.root_maxbytes=25000000
- path: /etc/sysctl.d/90-k3s-net.conf
content: |
net.ipv4.conf.all.forwarding=1
net.ipv6.conf.all.forwarding=1
- path: /tmp/install
content: |
zypper refresh
zypper dup -y
zypper install -y qemu-guest-agent nano htop container-selinux k3s-selinux open-iscsi nfs-client
systemctl enable --now qemu-guest-agent
sed -i "s/GRUB_TIMEOUT=10/GRUB_TIMEOUT=1/g" /etc/default/grub
grub2-mkconfig > /boot/grub2/grub.cfg
growpart:
mode: auto
devices: ['/', '/var']
runcmd:
- transactional-update run sh -c "$(cat /tmp/install)"
- curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_START=true INSTALL_K3S_SKIP_SELINUX_RPM=true sh -
- reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment