k3s bootstrap on Alpine Linux

Photo by Kevin Horvat on Unsplash

Explanation section

Experienced Users can skip ahead to Prepare alpine Linux

What is Alpine Linux?

What is k3s?

by Saiyam Pathak

Prepare alpine Linux:

Alpine Linux uses openrc (which is a Unix-like systems, a dependency-based init — the first process started during booting of the computer system) instead of systemd.

echo "cgroup /sys/fs/cgroup cgroup defaults 0 0" >> /etc/fstab
cat > /etc/cgconfig.conf <<EOF
mount {
cpuacct = /cgroup/cpuacct;
memory = /cgroup/memory;
devices = /cgroup/devices;
freezer = /cgroup/freezer;
net_cls = /cgroup/net_cls;
blkio = /cgroup/blkio;
cpuset = /cgroup/cpuset;
cpu = /cgroup/cpu;
}
EOF
default_kernel_opts="...  cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory"
update-extlinux
reboot

Initializing the k3s-server

Install cni-plugins and iptables:

apk add --no-cache cni-plugins --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
PATH=/usr/share/cni-plugins/bin:$PATH
apk add iptables
K3S_TOKEN=SECRET k3s server --cluster-init
K3S_TOKEN=SECRET k3s server --server https://<ip or hostname of server1>:6443
kubectl get nodes

Troubleshooting k3s:

cni-plugin not yet installed:

ERRO[0816] failed to find host-local: exec: "host-local": executable file not found in $PATH
iptables not found

--

--

Working as a IT-Operations engineer at NeXenio, a spin-off by Hasso-Plattner-Institute for products around a digitial workspace.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
D. Heinrich

D. Heinrich

Working as a IT-Operations engineer at NeXenio, a spin-off by Hasso-Plattner-Institute for products around a digitial workspace.