Cloud Native 10 min read

Why Choose K3s Over K8s? A Hands‑On Guide to Lightweight Kubernetes

This article explains the key differences between K3s and standard Kubernetes, walks through installing K3s, accessing the cluster, adding nodes, deploying an Nginx service with a ClusterIP and Ingress, and summarizes when to prefer K3s versus full‑featured K8s for lightweight, resource‑constrained environments.

Raymond Ops
Raymond Ops
Raymond Ops
Why Choose K3s Over K8s? A Hands‑On Guide to Lightweight Kubernetes

K3s vs K8s: What’s the Difference?

1. K3s – a lightweight Kubernetes

K3s is a CNCF‑certified Kubernetes distribution and Sandbox project designed for low‑resource environments, maintained by Rancher Labs. It packages most Kubernetes components into a single binary under 100 MB, removing optional drivers, volume plugins, and third‑party cloud integrations.

It runs on Linux with as little as 512 MiB RAM (1 GiB recommended) and a single CPU. The architecture still includes a master server and agents, CoreDNS, an Ingress controller, and a built‑in SQLite database, while allowing external databases such as etcd, MySQL, or PostgreSQL. Flannel is the default CNI.

Single binary with minimal external dependencies

Low hardware and memory requirements

Can run as a single‑server or high‑availability cluster

2. Using K3s

2.1 Install

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

This runs the official K3s installation script and starts K3s as a service. You can also download a specific version and install it, mixing server options with environment variables, e.g., to disable Flannel:

$ curl -sfL https://get.k3s.io | sh -s -- --flannel-backend none

Or set the variable before starting the server:

$ INSTALL_K3S_EXEC="--flannel-backend none" k3s server

2.2 Access the cluster

K3s places a kubeconfig file in /etc/rancher/k3s/k3s.yaml. Export it to use kubectl: $ export KUBECONFIG=/etc/rancher/k3s/k3s.yaml Alternatively copy it to the standard location:

$ mkdir -p ~/.kube
$ sudo k3s kubectl config view --raw | tee ~/.kube/config
$ chmod 600 ~/.kube/config

Check the cluster status:

$ kubectl get nodes
NAME   STATUS   ROLES               AGE   VERSION
<cluster-name>   Ready   control-plane,master   4d3h   v1.25.6+k3s1

List all pods:

$ kubectl get pods --all-namespaces
... (output omitted for brevity) ...

2.3 Add a node

Run the same install script on the worker host, providing the master URL and token:

$ curl -sfL https://get.k3s.io | K3S_URL=https://<node-host>:6443 K3S_TOKEN=mynodetoken sh -

Retrieve the token on the server with:

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

3. Deploy a Service

Create an Nginx deployment with three replicas:

$ kubectl create deployment nginx --image=nginx --port=80 --replicas=3

Verify the pods are running, then expose the deployment via a ClusterIP service:

$ kubectl create service clusterip nginx --tcp=80:80

Describe the service to see its endpoints:

$ kubectl describe service nginx
Name: nginx
Namespace: default
Type: ClusterIP
IP: 10.43.238.194
Port: 80/TCP
Endpoints: 10.42.0.10:80,10.42.0.11:80,10.42.0.9:80

Define an Ingress resource to route external traffic to the service:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: nginx
  annotations:
    ingress.kubernetes.io/ssl-redirect: "false"
spec:
  rules:
  - http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: nginx
            port:
              number: 80

Apply the Ingress and verify it:

$ kubectl apply -f <nginx-ingress-file>.yaml
$ kubectl describe ingress nginx

Access the application via the node’s IP (e.g., 192.168.1.103).

4. K8s vs K3s Summary

The most noticeable difference is packaging: K3s is a single <100 MB binary, while K8s consists of many separate processes. K3s starts a cluster in seconds, uses fewer resources, and supports AMD64, ARM64, and ARMv7, making it suitable for edge devices like Raspberry Pi.

For simple workloads and quick learning, K3s requires fewer commands and less operational overhead. However, for complex clusters or heavy workloads, full‑featured K8s remains the better choice, especially when advanced database integrations or cloud provider features are needed.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DeploymentKubernetesIngressK3slightweight
Raymond Ops
Written by

Raymond Ops

Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.