Community Tutorials Kubernetes How to Install k3s Lightweight Kubernetes
How to Install k3s Lightweight Kubernetes
KUBERNETES

How to Install k3s Lightweight Kubernetes

SKYLINE Knowledge Base
Photo by Growtika on Unsplash

A field-tested, step-by-step guide. How to Install k3s Lightweight Kubernetes — prerequisites, the actual commands, verification, and links to related Kubernetes topics.

k3s is a CNCF-certified Kubernetes distribution that fits in 60 MB, runs on a Raspberry Pi, and is what we reach for whenever a project's brief includes "we need Kubernetes but not the operational overhead." Single binary, sane defaults, perfect for edge + small clusters.

Prerequisites

  • One or more Linux hosts (Ubuntu 22.04 / Debian 12 / Rocky 9 all work).
  • 1 vCPU, 1 GiB RAM minimum per node.
  • curl, iptables, no conflicting Docker/containerd you care about (k3s ships its own).

Step 1: Install the control-plane node

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

Three minutes later you have:

  • kubectl at /usr/local/bin/kubectl (k3s-bundled)
  • A running cluster with one node
  • A kubeconfig at /etc/rancher/k3s/k3s.yaml

Test:

sudo k3s kubectl get nodes
sudo k3s kubectl get pods -A

Step 2: Use the kubeconfig as a non-root user

mkdir -p ~/.kube
sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
sudo chown $(id -u):$(id -g) ~/.kube/config
chmod 600 ~/.kube/config

kubectl get nodes
kubectl version

For remote access from your workstation, edit the server: line to point at the host's external IP instead of 127.0.0.1.

Step 3: Add worker nodes

On the control-plane node:

sudo cat /var/lib/rancher/k3s/server/node-token

Copy that token. On each worker:

curl -sfL https://get.k3s.io | K3S_URL=https://control-plane.example.sa:6443 \
                              K3S_TOKEN=<token> sh -

On the control-plane:

kubectl get nodes -o wide

Workers show up as worker role within ~30 seconds.

Step 4: What k3s installs out of the box

kubectl get pods -A
# kube-system:
#   coredns      — cluster DNS
#   local-path-provisioner — PVCs from local disk (great default)
#   metrics-server         — kubectl top
#   traefik                — built-in ingress controller
#   svclb-traefik-*        — LoadBalancer Service support via klipper-lb

Disable any of them at install time with INSTALL_K3S_EXEC="server --disable traefik --disable servicelb" — handy if you want to run nginx-ingress instead.

Step 5: Test workload

kubectl create deployment hello --image=nginxdemos/hello:latest
kubectl expose deployment hello --port=80 --type=NodePort
kubectl get svc hello                          # note the NodePort, e.g. 31234

curl http://control-plane.example.sa:31234/   # static "Hello" page

Step 6: Update / uninstall

Update k3s in place:

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

Or pin a version on install:

curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.30.2+k3s1 sh -

Uninstall cleanly (it ships its own script):

/usr/local/bin/k3s-uninstall.sh           # control-plane
/usr/local/bin/k3s-agent-uninstall.sh     # worker

Verify

kubectl get nodes -o wide
kubectl get pods -A
kubectl version
sudo systemctl status k3s --no-pager

Conclusion

k3s gives you a real Kubernetes cluster — same kubectl, same manifest format — in one curl. For learning, edge, IoT, and small in-house apps, it is the right choice over a full kubeadm install.

Next steps

SKYLINE Engineering

@skyline

The engineering team at SKYLINE Industrial Solutions. We publish field-tested guides drawn from real KSA and GCC deployments.

See author profile
SKYLINE engineering services

Need this implemented for you?

Reading is free — building it right takes a team. SKYLINE engineers ship Kubernetes for Aramco vendors, banks, hospitals and government agencies across Saudi Arabia. Talk to us before you start.

Aramco Approved Contractor ISO 9001 · ISO 27001 SAMA CSF aligned NCA ECC ready 247+ KSA clients

Comments

0 total · 0 threads
Be the first to leave a comment.