Deploy a Lightweight Kubernetes Cluster with k3s – Step‑by‑Step Guide
This article explains what k3s is, why it’s named that way, and provides detailed, command‑line instructions for installing k3s on a master node, adding worker nodes, verifying the cluster status, and inspecting running containers, all with example outputs and a link to the official documentation.
What is k3s?
k3s is a lightweight distribution of Kubernetes designed for resource‑constrained environments. It can run with as little as 512 MiB of RAM and the total size of its binaries is under 100 MB. Since its initial release in March 2019 it has attracted more than 16 000 GitHub stars and is widely used for edge‑computing Kubernetes deployments.
Why the name k3s?
The name reflects the goal of halving the memory footprint of a full Kubernetes installation. "Kubernetes" has ten letters; a version that is roughly half the size is represented by the five‑letter abbreviation "k3s" (K‑3‑S). The project has no official full name or pronunciation.
Install k3s on the control‑plane (master) node
Run the official installation script, which installs k3s as a systemd service: curl -sfL https://get.k3s.io | sh After the script finishes the service starts automatically. Verify it with: systemctl status k3s The generated kubeconfig file is located at /etc/rancher/k3s/k3s.yaml. The installation also provides the following binaries:
kubectl
crictl
k3s‑killall.sh
k3s‑uninstall.sh
Install k3s on worker nodes
Obtain the node token from the control‑plane node: sudo cat /var/lib/rancher/k3s/server/node-token Then install k3s on each worker, passing the control‑plane address and token (or K3S_CLUSTER_SECRET) as environment variables:
k3s_url="https://k3s-master:6443"
k3s_token="K1042e2f8e353b9409472c1e0cca8457abe184dc7be3f0805109e92c50c193ceb42::node:c83acbf89a7de7026d6f6928dc270028"
curl -sfL https://get.k3s.io | K3S_URL=${k3s_url} K3S_TOKEN=${k3s_token} sh -Verify the cluster
Check that the service is running and list the cluster nodes:
sudo systemctl status k3s
sudo kubectl get nodes
sudo kubectl cluster-infoTypical output shows the control‑plane and any worker nodes in a Ready state, together with the Kubernetes version (e.g., v1.14.6‑k3s.1). Additional checks can be performed with:
sudo kubectl get namespaces
sudo kubectl get endpoints -n kube-system
sudo kubectl get pods -n kube-systemInspect containers with crictl
Use crictl to view running containers on both control‑plane and worker nodes. Example command:
# on any node
sudo crictl psThe output lists container IDs, images, creation timestamps, states, and associated pod IDs.
Reference
Official k3s documentation: https://rancher.com/docs/k3s/latest/en/
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Full-Stack DevOps & Kubernetes
Focused on sharing DevOps, Kubernetes, Linux, Docker, Istio, microservices, Spring Cloud, Python, Go, databases, Nginx, Tomcat, cloud computing, and related technologies.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
