Skip to content

k3s

Website k3s docs

Requirements

Minimal K3S requirements:

Server / Control plane Agent / Node
Disk space 15 GB 15 GB
RAM 2 GB 512 MB
CPU 2 cores 1 core

Installation

curl2bash

curl -sfL https://get.k3s.io | sh -
sudo k3s kubectl get node

Uninstall:

/usr/local/bin/k3s-uninstall.sh

Remove agent from cluster

kubectl delete node NODENAME

Optimization

Upgrade

  • Manual upgrades
  • Beware that for arm nodes the dedicated arm64 image needs to get downloaded!
systemctl stop k3s-agent.service
wget https://github.com/k3s-io/k3s/releases/download/v1.35.3%2Bk3s1/k3s -O /usr/local/bin/k3s
k3s --version
systemctl start k3s-agent.service

Usage

Use k3s crictl cmd:

k3s crictl images

Manually prune unused images:

k3s crictl rmi --prune

Resource usage

k3s components

networking

The K3s server needs port 6443 to be accessible by all nodes. The nodes need to be able to reach other nodes over UDP port 8472 when using the Flannel VXLAN backend, or over UDP port 51820 (…) when using the Flannel WireGuard backend

Tailscale integration

Issues:

  • Unable to add advertised route when using tailscale
  • After rebooting the nodes can't communicate with each other or the controlplane. Possible issues:
    • The ACL are gone -> Run Opentofu to recreate them
    • The advertised routes are gone -> Manually advertise routes

servicelb

CoreDNS

Customizing CoreDNS

  • K8s docs: Customizing DNS Service
  • k3s coredns Corefile imports config files from /etc/coredns/custom/*.server
  • If the configMap coredns-custom is present, it will get mounted to /etc/coredns/custom and imported by the main Corefile

k3s wrappers / installers

k3d

k3s in docker: k3d

K3s ansible module