K3S Cluster creation

Proxmox

Create a new lxc privileged container with nested feature for docker

Make sure you dont start the container after creation

Need to open the shell on the node where the new container is created

/etc/pve/lxc/xxx.conf

1
2
3
4
lxc.apparmor.profile: unconfined
lxc.cgroup.devices.allow: a
lxc.cap.drop:
lxc.mount.auto: "proc:rw sys:rw"

Start the lxc container

Container

1
2
3
4
5
6
apt update && apt upgrade -y && apt install curl nfs-common-y
echo '#!/bin/sh -e
ln -s /dev/console /dev/kmsg
mount - make-rshared /' > /etc/rc.local
chmod +x /etc/rc.local
reboot

After restart log back into the lxc container and install K8S

This setup requires an external mysql to be used

1
2
3
4
5
6
curl -sfL https://get.k3s.io | sh -s - server \
  --token=TOKEN \
  --tls-san=10.10.0.1 \
  --datastore-endpoint="mysql://kubernetes:$PASSWORD@tcp($MYSQL_HOST:3306)/kubernetes" \
  --cluster-cidr=172.16.0.0/16 \
  --disable=traefik
All rights reserved