Run lightweight Kubernetes with k3s
k3s is a complete, certified Kubernetes distribution packed into one binary that installs with a single command on the Ubuntu 24.04 image. One server runs the control plane and your workloads; a second and third server join as agents over a private WireGuard link. Traefik ingress and local-path storage come built in, cert-manager adds certificates. Arm plans such as A8 and A16 are a natural fit in Europe.
Self-hosted apps guide, updated 2026-12-03
What is k3s, and when is Kubernetes overkill?
k3s is a Kubernetes distribution that bundles the API server, scheduler, controller manager, kubelet, containerd, flannel networking, CoreDNS, the Traefik ingress controller, a service load balancer and a local storage provisioner into one process. On a single node it stores cluster state in SQLite instead of etcd, which keeps memory low. Everything you learn applies to any Kubernetes cluster.
Be honest about the need first. If you run a handful of containers on one server, Docker Compose or the Coolify image is less to learn and less to maintain. Kubernetes pays off when you deploy many services with the same manifests, want rolling updates and self-healing across several machines, use Helm charts from vendors, or are practising for work that runs on Kubernetes. A small cluster here is also a cheap way to learn the real thing on real servers.
Which plan sizes and cities fit a k3s cluster?
A k3s server node uses roughly 500~800 MB of RAM for itself before your pods; an agent uses less. Add your workloads on top.
| Layout | Plan per node | Specs |
|---|---|---|
| Single node lab or small apps (Europe) | A8 | 4 vCPU, 8 GB RAM, 80 GB NVMe |
| 1 server + 2 agents for real workloads (Europe) | A16 | 8 vCPU, 16 GB RAM, 160 GB NVMe |
| Single node outside Europe | P4 | 2 vCPU, 4 GB RAM, 80 GB NVMe |
| Busy nodes with steady CPU use | D16 | 4 vCPU, 16 GB RAM, 160 GB NVMe |
Arm plans are available in Frankfurt, Nuremberg, Helsinki and Amsterdam. k3s, containerd and most public images ship arm64 builds; check that your own images are multi-arch before choosing Arm. Keep all nodes in one city: the control plane and pod network expect low latency between nodes. Spreading across cities is better solved with separate clusters.
How do you install a single node?
On a fresh Ubuntu 24.04 server, write a config file first so the install is repeatable:
mkdir -p /etc/rancher/k3s
cat > /etc/rancher/k3s/config.yaml <<EOF
write-kubeconfig-mode: "0600"
tls-san:
- k8s.example.com
- 203.0.113.10
EOF
curl -sfL https://get.k3s.io | sh -The script installs the binary to /usr/local/bin/k3s, creates the k3s systemd service and links kubectl. After about half a minute:
kubectl get nodes
NAME STATUS ROLES AGE VERSION
vps-fra1 Ready control-plane,master 40s v1.xx.x+k3s1The kubeconfig is /etc/rancher/k3s/k3s.yaml. To use it from your laptop, copy it, replace 127.0.0.1 with k8s.example.com and only allow port 6443 from your own address. Pin a release channel with INSTALL_K3S_CHANNEL=stable or an exact version with INSTALL_K3S_VERSION if you need predictable upgrades.
How do you join agents over a WireGuard link?
CheapVPS servers have public addresses only, so build the private network in the OS. Create a WireGuard interface wg0 on every node, for example 10.10.0.1 on the server and 10.10.0.2, 10.10.0.3 on the agents, as shown in a private link with WireGuard. Then tell k3s to use those addresses. On the server, extend the config and restart:
# /etc/rancher/k3s/config.yaml on the server
node-ip: 10.10.0.1
advertise-address: 10.10.0.1
flannel-iface: wg0
tls-san:
- 10.10.0.1
- k8s.example.comsystemctl restart k3s
cat /var/lib/rancher/k3s/server/node-tokenOn each agent:
mkdir -p /etc/rancher/k3s
cat > /etc/rancher/k3s/config.yaml <<EOF
node-ip: 10.10.0.2
flannel-iface: wg0
EOF
curl -sfL https://get.k3s.io | K3S_URL=https://10.10.0.1:6443 K3S_TOKEN=paste-node-token sh -Back on the server, kubectl get nodes -o wide lists all three with their 10.10.0.x internal IPs. For three servers that all run the control plane instead, start the first with cluster-init: true to use embedded etcd and join the others as servers with the same token; that needs an odd number of server nodes and open etcd ports.
VXLAN over WireGuard or the wireguard-native backend?
Flannel defaults to VXLAN on UDP 8472. VXLAN is not encrypted, so on public networks it must run inside your WireGuard tunnel, which is what flannel-iface: wg0 above does. The alternative is to let flannel build its own encrypted mesh:
# server config.yaml, instead of the manual wg0 layout
flannel-backend: wireguard-native
node-external-ip: 203.0.113.10With wireguard-native each node talks to the others directly over UDP 51820 (51821 for IPv6), and you set node-external-ip on every node to its public IPv4. It needs no hand-written WireGuard config, but the k3s API and kubelet then also travel over public addresses, so restrict 6443 and 10250 by source address. A manual wg0 tunnel keeps all node traffic private and is the easier layout to firewall. Both work; pick one before you join agents, as changing the backend later means reinstalling.
Which ports must be open between nodes and to the world?
| Port | Protocol | Who needs it |
|---|---|---|
| 6443 | TCP | Agents to server (Kubernetes API), plus your laptop |
| 10250 | TCP | All nodes to each other (kubelet metrics and logs) |
| 8472 | UDP | Between nodes, flannel VXLAN (inside wg0) |
| 51820 / 51821 | UDP | Between nodes, WireGuard (manual tunnel or wireguard-native) |
| 2379~2380 | TCP | Between server nodes, only with embedded etcd |
| 80, 443 | TCP | Internet to Traefik ingress |
With ufw and the wg0 layout:
ufw allow 22/tcp
ufw allow 80/tcp
ufw allow 443/tcp
ufw allow 51820/udp
ufw allow in on wg0
ufw allow from 10.42.0.0/16
ufw allow from 10.43.0.0/16
ufw enableThe last two lines allow the default pod and service networks. Without them ufw drops pod traffic and DNS inside the cluster fails in confusing ways. Rules in detail: firewall setup.
How do Traefik ingress and cert-manager give you HTTPS?
k3s ships Traefik as the ingress controller and ServiceLB, which binds ports 80 and 443 on the node addresses. Point app.example.com at a node IPv4 and create a Deployment, Service and Ingress as usual. Install cert-manager from its release manifests (replace the version with the current one):
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.16.0/cert-manager.yaml
kubectl -n cert-manager get podsThen create a ClusterIssuer for the Let's Encrypt production endpoint that solves HTTP-01 through Traefik:
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt
spec:
acme:
server: https://acme-v02.api.letsencrypt.org/directory
email: admin@example.com
privateKeySecretRef:
name: letsencrypt-key
solvers:
- http01:
ingress:
ingressClassName: traefikAdd the annotation cert-manager.io/cluster-issuer: letsencrypt and a tls block with a secretName to your Ingress, and cert-manager requests and renews the certificate. kubectl describe certificate shows progress. The background is explained in TLS certificates explained.
How does local-path storage on NVMe work?
The bundled local-path provisioner is the default StorageClass. A PersistentVolumeClaim gets a folder under /var/lib/rancher/k3s/storage on the node where the pod is scheduled, so the data sits on that node NVMe disk with full local speed. The catch: the volume is tied to that node. If the node is lost, so is the data, and the pod cannot move to another node while it still needs the volume.
That suits databases with their own replication, caches and single-node setups. For shared storage across nodes you would add a distributed storage system, which needs spare disk and RAM on every node and is rarely worth it on three small servers. The simpler path is to keep stateful services on one labelled node and back up their volumes. Check usage with df -h /var/lib/rancher.
How do you update the cluster and keep backups?
Updates. Rerun the install script with the same config on the server first, then on each agent; k3s replaces the binary and restarts. kubectl drain node --ignore-daemonsets before and kubectl uncordon after keeps workloads moving. For hands-off upgrades, the system-upgrade-controller applies a Plan resource node by node.
Backups. On a single server with SQLite, back up /var/lib/rancher/k3s/server/db/, the token at /var/lib/rancher/k3s/server/token and your manifests. With embedded etcd, k3s takes scheduled snapshots to /var/lib/rancher/k3s/server/db/snapshots, and k3s etcd-snapshot save makes one on demand. Persistent volumes need their own backup, for example restic over /var/lib/rancher/k3s/storage or the application dump tool. Keep manifests in Git so the cluster can be rebuilt from scratch. The disk backup add-on ($1.57 per month on A8) adds 7 daily copies of each node.
What goes wrong most often with k3s?
- Agent stuck NotReady: it cannot reach 6443 on the server address it was given, or the token is wrong. Check
journalctl -u k3s-agent -e. - Pods on different nodes cannot talk: UDP 8472 or 51820 is blocked, or
flannel-ifacepoints at the public interface. Test the tunnel withping 10.10.0.2. - DNS lookups time out inside pods: ufw drops pod network traffic; add the 10.42/10.43 rules.
- Certificate stays pending: the hostname does not point to a node, or port 80 is closed.
kubectl describe challenge -Anames the cause. - Node runs out of memory: set resource requests and limits on every Deployment, and keep the server node light.
Questions about this guide
Can I run k3s on a single server?
Yes. One node runs both the control plane and workloads, using SQLite as its datastore. It is the simplest start and can take agents later.
Do Arm and x86 nodes mix in one cluster?
They can, as long as every image you deploy is multi-arch. Keeping all nodes on one architecture avoids surprises; Arm plans are in Europe only.
Is there a managed load balancer in front of the cluster?
No. ServiceLB binds 80 and 443 on each node; point DNS at one or more node IPs, or run HAProxy as described in the HAProxy guide.
Can I use a private network between nodes?
The console has no private network option, so you build one with WireGuard on the nodes, or use the wireguard-native flannel backend.
How many nodes do I need for high availability?
Three server nodes with embedded etcd tolerate the loss of one. A single server with two agents keeps workloads running if an agent fails, but not if the server does.
Can I disable Traefik and use another ingress?
Yes. Add disable: [traefik] to the server config before install, then deploy your preferred controller with Helm.