DevOps Blog

Install K3S on Ubuntu: A Lightweight Kubernetes Solution

Install K3S on Ubuntu: A Lightweight Kubernetes Solution

Introduction

Kubernetes is an amazing container environment that allows you to run and manage your containers, jobs, storage and many other convenient tools to manage your deployments.

That said, it can be quite large and difficult to configure which to be fair in a busy production environment is needed for the reliability that it give you.

Sometime though, like in our case, we only need a lightweight solution to keep our containers up and running. We have a few Next.js Apps, a MariaDB and a Strapi Headless CMS plus the random things we develop for this blog. Although I want to keep all of these up and running it's not revenue critical so I don't really need all the nodes that a standard Kubernetes Cluster utilizes to keep a high traffic environment up and running.

Cue K3S, A lightweight Kubernetes solution that can be installed on a single node, a single binary and uses around 512MB of RAM which is extremely small and is ideal for us and we get all the features of Kubernetes. On top of that the installation is very easy too.

With that said, lets look at how to install K3S on Ubuntu.

Cool things about K3S

K3S simplifies the deployments and configuration of Kubernetes but it also helps you out by adding some sane defaults to help you get up and running quicker.

Ingress: K3S by default installs and configures Traefik by default so you can get straight to deploying your websites without having to worry about setting up a load balancer and installing an ingress provider. Open ports 80 and 443 on your firewall and you're good to go.

StorageClass: The local-path storage class in configured by default so if you need persistent storage you can create a PersistentVolumeClaim with local-path storageClassName and you have storage.

A note on Storage: this saves the data to a directory on the node so make sure you backup your data somewhere off the node as it would be lost if the server became unrecoverable.

Adding nodes: Although K3S will happily work on just one node. If the time comes when you need to add another node you can spin up another instance and run curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION="v1.X.Y+k3s1" K3S_URL=https://<SERVER_IP>:6443 K3S_TOKEN=<NODE_TOKEN> sh - and it will install and attach your node.

Installation

For this guide I'll be using Ubuntu 26.04 which has been configured from this guide the blog.

Before we begin, ensure you have:

  • An Ubuntu 26.04 system (physical or virtual)
  • Sudo privileges
  • At least 1GB of RAM (2GB recommended)
  • At least 1 vCPU (2 recommended)
  • Stable internet connection

https://davidbarszczak.com/devops-blog/tsveb4c1jrbfajf2wg218e7v

The first thing we always do is get the server up to date. After the upgrade you may need to reboot your server.

sudo apt update && sudo apt upgrade -y

We will need to make sure we have some packages that we will need to install K3S.

sudo apt install -y curl wget

We're going to install the most basic configuration. A single node that runs both the server and agent on them. This will give us a single node Kubernetes installation.

curl -sfL https://get.k3s.io | sh -
[INFO] Finding release for channel stable [INFO] Using v1.36.2+k3s1 as release [INFO] Downloading hash https://github.com/k3s-io/k3s/releases/download/v1.36.2%2Bk3s1/sha256sum-amd64.txt [INFO] Downloading binary https://github.com/k3s-io/k3s/releases/download/v1.36.2%2Bk3s1/k3s [INFO] Verifying binary download [INFO] Installing k3s to /usr/local/bin/k3s [INFO] Skipping installation of SELinux RPM [INFO] Creating /usr/local/bin/kubectl symlink to k3s [INFO] Creating /usr/local/bin/crictl symlink to k3s [INFO] Creating /usr/local/bin/ctr symlink to k3s [INFO] Creating killall script /usr/local/bin/k3s-killall.sh [INFO] Creating uninstall script /usr/local/bin/k3s-uninstall.sh [INFO] env: Creating environment file /etc/systemd/system/k3s.service.env [INFO] systemd: Creating service file /etc/systemd/system/k3s.service [INFO] systemd: Enabling k3s unit Created symlink '/etc/systemd/system/multi-user.target.wants/k3s.service' → '/etc/systemd/system/k3s.service'. [INFO] systemd: Starting k3s

We can confirm that the installation was successful and that the services are up and running with the following.

sudo systemctl status k3s
k3s.service - Lightweight Kubernetes Loaded: loaded (/etc/systemd/system/k3s.service; enabled; preset: enabled) Active: active (running) since Sat 2026-07-04 16:15:28 UTC; 3min 24s ago

It may take a moment for everything to come online but we can now check the status of our node with the following command.

sudo k3s kubectl get nodes
NAME STATUS ROLES AGE VERSION ubuntu-server Ready control-plane 9m32s v1.36.2+k3s1

As easily as that we now have a working K3S Kubernetes single node cluster that we can use just like any other Kubernetes cluster.

Lets add some quality of life configuration to our cluster to make things feel a little more standard.

In older versions of k3s you needed to install a vanilla version of kubectl if you wanted to use it without the k3s command. I this version however it comes already with the install. The only problem is that the configuration is stored at /etc/rancher/k3s/k3s.yaml and it owned by root so your non-root account won't have permissions to read it

sudo kubectl get pods -A
[sudo: authenticate] Password: NAMESPACE NAME READY STATUS RESTARTS AGE kube-system coredns-5f5694d56b-pswd6 1/1 Running 0 107m kube-system helm-install-traefik-crd-wwgwg 0/1 Completed 0 107m kube-system helm-install-traefik-w5lmg 0/1 Completed 2 (107m ago) 107m kube-system local-path-provisioner-58d557dc48-dhlg5 1/1 Running 0 107m kube-system metrics-server-7c86f97b8d-4hl56 1/1 Running 0 107m kube-system svclb-traefik-5a218989-nqpnq 2/2 Running 0 106m kube-system traefik-6cd8c7cd89-f894f 1/1 Running 0 106m

If you want to allow your user to access the kubectl command without needing to use sudo you can copy the configuration to your home directory but keep in mind security considerations. Do not change the permissions on /etc/rancher/k3s/k3s.yaml as this is a known security concern.

mkdir -p ~/.kube sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config sudo chown $USER:$USER ~/.kube/config echo 'export KUBECONFIG=~/.kube/config' >> ~/.bashrc source ~/.bashrc
kubectl get pods -A

Now you have a fully working Kubernetes single node server that is ideal for lightweight loads which is ideal for small deployments that don't need a full Kubernetes cluster.

To test you can create a deployment.yaml and put in the following configuration.

apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: replicas: 1 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:latest ports: - containerPort: 80

Then apply the configuration as you normally would.

kubectl apply -f deployment.yaml

Check that your deployment has worked and is running as expected.

kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE nginx-deployment 1/1 1 1 32s

With that, the K3S server is now completed and you can use it as you would any other Kubernetes setup.

I hope you found this guide useful and helps you on your DevOps journey.