K3s is a lightweight Kubernetes distribution created by Rancher Labs, and it is highly available and production-ready. It has a small binary size and low resource requirements. In simple words, K3s is a lightweight, simplified version of Kubernetes that's easier to install and run on smaller computers. This tutorial on PerLod Hosting will cover how to install K3s on Ubuntu 24.04 in a single-node environment. Carefully follow the instructions, and at last, you have a K3s single-node complete setup.
To try out this guide, you’ll need a Ubuntu server. If you don’t already have one, you can get a reliable VPS Hosting Service or Dedicated Server from PerLod. Our plans are optimized for Kubernetes and K3s deployments, which gives you the perfect environment to follow along with this tutorial.
Why Use K3s? Use Case Examples
When you need the power of containers and Kubernetes but without complex and high resource requirements, K3s is a great choice. It is simple, light, and fast.
It can deploy and manage apps on low-power devices like Raspberry Pis in factories, retail stores, etc. K3s offers developers easily install Kubernetes on their local machines. Also, it can be useful for home labs and learning. Furthermore, K3s serves as a modern container platform for embedded systems in field appliances and is perfectly suited for CI/CD pipelines.
K3s vs Kubernetes (footprint, dependencies):
Aspect
Kubernetes (K8s)
K3s
Footprint
Heavy. Requires significant CPU, RAM, and storage.
Extremely light. Single binary, ~50MB. Minimal resource usage.
Dependencies
Complex. Often requires multiple services and add-ons to be configured.
Simple. Bundles everything into the binary.
Once your are understand the concept of K3s, proceed to the following steps to start a K3s single-node setup on Ubuntu 24.04.
Prerequisites
To set up K3s, you need the following requirements:
An Ubuntu 24.04 with sudo access
Public IP Address
Open Ports 80 and 443 through the firewall
A domain name points to your Public IP address
Note: By default, K3s installs Traefik as the Ingress Controller. With Traefik, K3s will start routing external terrific with ease.
At this point, prepare the Ubuntu 24.04 server for installing K3s.
Disabling Swap for K3s
First, you must disable swap on your server. To do this, run the following commands:
Finally, verify the details of the new "nginx" service, specifically the port number you need to use to access the website:
Bash
kubectlgetsvcnginx
You can test your Nginx deployment by using the curl command and the port number you got from the above command:
Bash
curlhttp://server-ip-address:NodePort
If you see the Welcome to nginx page, the deployment is healthy.
Publish Nginx on port 80 with Traefik Ingress
It is recommended to use K3s' built-in Ingress Traefik to make your service accessible with your domain name on port 80/443.
First, create a file named nginx-ingress.yaml:
Bash
sudonanonginx-ingress.yaml
Then, add the following content to the file with your domain name. This config is a map that connects a public website address to the internal service.
Then, run the following command to create the Ingress rule (the traffic map) defined in the nginx-ingress.yaml file:
Bash
kubectlapply-fnginx-ingress.yaml
At this point, you can test your Ingress rule so you can access the Nginx website from your browser. Use the command below:
Bash
curlhttp://perlod.lab.net/
You should see the default Nginx welcome page. This proves that Traefik (on port 80) successfully received your request for Perlod.lab and routed it to the correct Nginx service.
Multiple domains on one service:
If you want to connect multiple domains to the same service, you can add multiple rules with different hosts within the same Ingress. For example:
Then, use the following command to completely remove the K3s software and all of its components from your server:
Bash
sudo/usr/local/bin/k3s-uninstall.sh
Conclusion
In this step, you have successfully prepared your system (disabled swap, configured kernel parameters with sysctl, loaded modules), installed K3s and verified its service was running, deployed Nginx as a sample application, and it is using a Traefik Ingress on port 80.
You can now use this same structure for your real applications. You must create an internal Service and use an Ingress to publish it to the internet with different domain names.
We hope this guide (install K3s on Ubuntu 24.04) is useful for you. If you need any help, feel free and ask. Subscribe to us on X and Facebook for the latest Kubernetes updates and guides.
K3s bundles key components such as containerd, CoreDNS, Traefik Ingress Controller, Local Path Provisioner, and a service load-balancer.
Depending on the mode, it has a different location. Under the system, use journalctl -u k3s. If it runs with OpenRC, logs in /var/log/k3s.log. Pod logs in /var/log/pods, and containerd logs in /var/lib/rancher/k3s/agent/containerd/containerd.log.
You can start K3s with the flag: --disable=traefik. This will disable the built-in Traefik so you can deploy your own Ingress controller.
By default, K3s uses SQLite. You can also configure external datastores like MySQL, MariaDB, or PostgreSQL for HA setups.
We use cookies to run PerLod and to understand how the site is used. You can accept everything, or open Manage to turn individual categories off. Cookie policy.