Skip to content
Log In Sign Up info@muvcloud.com

K3s in Short

K3s runs the standard Kubernetes API, so kubectl, Helm, and ordinary manifests work as on any cluster. What changes is the packaging: the control plane, the kubelet, and containerd run from one binary, and the parts a cluster needs to be useful are included from the start.

K3s vs Full Kubernetes

K3sFull Kubernetes
InstallOne binary, one scriptSeveral components
DatastoreSQLite, or etcdetcd
Runtimecontainerd, built inInstalled separately
NetworkingFlannel, built inYour choice
IngressTraefik, built inYour choice
Typical useSmall and edge clustersLarge clusters

A single server uses an embedded SQLite datastore by default. For several control-plane servers, you start the first one with --cluster-init to use embedded etcd, or point K3s at an external database. It also ships CoreDNS, a simple load balancer for services, a local storage provisioner, and the metrics server.

Requirements

  • Memory and CPU: the documented minimum for a server node is 2 cores and 2 GB of RAM; your workloads come on top.
  • A modern Linux system: K3s is expected to work on most of them; the requirements page lists extra steps for the RHEL family and for Ubuntu and Debian, mostly about the firewall.
  • Ports 80 and 443: the bundled Traefik takes ports 80 and 443 on the server. Install K3s on a server without another web server, or plan around it.
  • A snapshot: take one before you start, so you can return to a clean system; see snapshot vs backup.

What the Install Script Does

The project's documented install is a shell script from https://get.k3s.io, run as root. It detects the processor type, downloads the K3s binary of the stable release and checks its checksum, installs it to /usr/local/bin/k3s, adds kubectl, crictl, and ctr links, writes a systemd service named k3s, creates k3s-uninstall.sh and k3s-killall.sh, and starts the service. On AlmaLinux and Rocky Linux it also adds a repository and installs the K3s SELinux policy package, k3s-selinux. Download it and read it before you run it:

curl -sfL https://get.k3s.io -o k3s-install.sh
less k3s-install.sh
sudo sh k3s-install.sh

The often-quoted one-line form pipes the same script into a shell without that review step.

Check the Node

sudo systemctl status k3s
sudo kubectl get nodes

After a minute, the server appears with the status Ready. sudo kubectl get pods -A lists the system components; all of them should reach Running or Completed. Everyday commands are in the kubectl cheat sheet.

The Kubeconfig File

K3s writes the admin credentials to /etc/rancher/k3s/k3s.yaml, readable only by root. To use kubectl without sudo, copy it into your own account and keep it private:

mkdir -p ~/.kube
sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
sudo chown $USER:$USER ~/.kube/config
chmod 600 ~/.kube/config
export KUBECONFIG=~/.kube/config

The file points to https://127.0.0.1:6443. To use it from your own computer, copy it there and forward the port through SSH with ssh -L 6443:127.0.0.1:6443 user@your_server_ip instead of opening the API to the internet; see SSH port forwarding.

Firewall Ports

PortUsed for
6443/tcpKubernetes API
10250/tcpKubelet, between nodes
8472/udpFlannel, between nodes
2379-2380/tcpetcd, between servers

On a single server, none of these needs to be open to the internet. Open them only to the addresses of your other nodes; the etcd ports matter only with several servers. The K3s documentation recommends turning UFW and firewalld off, but on a server reachable from the internet keep the firewall on and use the rules the documentation gives for that case: allow traffic from the pod network 10.42.0.0/16 and the service network 10.43.0.0/16, so pods can reach each other and the API. See UFW allow port and firewalld basics.

Uninstall K3s

The uninstall script stops K3s and all pods, and removes the binary, the scripts and tools, the service, the cluster datastore, and the data stored by the local storage provisioner. The K3s documentation warns that this may cause data loss. Back up anything you need first:

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

On a node that was added as an agent, the script is named k3s-agent-uninstall.sh.

Updated:

Linux VPS with Full Root Access

MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.

Cloud VPS Plans Starting at2.99 $/mo Cheap Linux VPS

No Limits on Service or Support

You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

Support specialist
  • 100% customer satisfaction goal
  • Our own hardware
  • 24/7 ticket and email support
  • 4 countries with locations