Update packages
apt-get update && apt-get dist-upgrade -y
Setup unattended upgrades
dpkg-reconfigure --priority=medium unattended-upgrades
Add swap for dev/CI setup
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
Create file /etc/rancher/k3s/config.yaml
with following.
write-kubeconfig-mode: "0644"
disable: traefik
cluster-init: true
flannel-backend: none
disable-network-policy: true
token: "changeit"
Place the file in all servers and agents.
Add odd number of server(s), start with 1.
curl -sfL https://get.k3s.io | sh -
Add agents (optional)
curl -sfL https://get.k3s.io | K3S_URL=https://${SERVER_IP}:6443 sh
Note: set $SERVER_IP
to ip of the server / internal lb
Source: https://projectcalico.docs.tigera.io/getting-started/kubernetes/k3s/quickstart
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.25.0/manifests/tigera-operator.yaml
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.25.0/manifests/custom-resources.yaml