Skip to content

Instantly share code, notes, and snippets.

@bukowa
Last active November 2, 2022 11:27
Show Gist options
  • Save bukowa/9dbb06c255ffb60a1b78bd493287db07 to your computer and use it in GitHub Desktop.
Save bukowa/9dbb06c255ffb60a1b78bd493287db07 to your computer and use it in GitHub Desktop.
k3s alpine cloned vm prepare
#!/bin/sh
set -eu
IP=${1}
HOST=${2}
echo "${HOST}" > /etc/hostname
printf "127.0.0.1\tlocalhost\n::1\tlocalhost\n" > /etc/hosts
sed -i "s/address.*/address $IP/" /etc/network/interfaces
INTERFACE=$(ls /sys/class/net | head -n1)
ifdown $INTERFACE && ifup $INTERFACE
printf 'https://dl-cdn.alpinelinux.org/alpine/v3.16/main\nhttps://dl-cdn.alpinelinux.org/alpine/v3.16/community\n' > /etc/apk/repositories
apk update
apk add nano bind-tools curl
rc-update add cgroups default
rc-service cgroups start
swapoff -a
curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_ENABLE=true sh -
k3s check-config
#!/bin/sh
set -eu
apk update
apk add nano bind-tools curl
rc-update add cgroups default
rc-service cgroups start
swapoff -a
curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_ENABLE=true sh -
k3s check-config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment