k3s on Ubuntu 24.04 LTS

k3s on Ubuntu 24.04 LTS

·

2 min read

This guide outlines the steps to install K3s on an Ubuntu 24.04 LTS server with 8 vCPUs and 16GB of memory. It’s tailored for single-node setups but can be extended to multi-node environments.

Server Requirements

  • Ubuntu version: 24.04 LTS

  • CPU: 8 vCPUs

  • Memory: 16GB RAM

  • Storage: At least 20GB of free disk space

  • Access: Root or a user with sudo privileges


Update the System

sudo apt update && sudo apt upgrade -y

Install Prerequisites

Install necessary dependencies:

sudo apt install -y curl wget software-properties-common

Install K3s

Use the official K3s installation script without Traefik:

💡
Change INSTALL_K3S_NAME=NODE-NAME to your desired node name
sudo curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--disable=traefik" INSTALL_K3S_NAME=NODE-NAME K3S_KUBECONFIG_MODE="644" INSTALL_K3S_VERSION="v1.30.6+k3s1" sh -

The script will:

  • Install the specified version of K3s (v1.30.6+k3s1).

  • Configure it as a systemd service.

  • Set up a lightweight Kubernetes distribution.

See the documentation: k3s Installation Guide


Verify Installation

Check if K3s is running:

sudo systemctl status k3s

Expected output should include a status of active (running).


Access Kubernetes

By default, K3s installs kubectl. You can check its version to ensure proper installation:

kubectl version --client

Get Node and Cluster Info

Verify the node and cluster status:

kubectl get nodes -o wide
kubectl cluster-info

Setup Aliases

For convenience, add aliases from my previous article.

Apply the changes:

source ~/.bash_aliases

Install NGINX Load Balancer Ingress Controller

Learn more about the NGINX Ingress Controller.

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.11.3/deploy/static/provider/baremetal/deploy.yaml

Please check if your Kubernetes version is supported.
We are using k3s v1.30.6, which is compatible with Ingress NGINX v1.11.3.

See the documentation: NGINX Ingress Controller Installation Guide.


Create NGINX Load Balancer Ingress Controller

touch nginx-lb.yaml

Paste the content below into the file:

apiVersion: v1
kind: Service
metadata:
  name: ingress-nginx-controller-loadbalancer
  namespace: ingress-nginx
spec:
  selector:
    app.kubernetes.io/component: controller
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/name: ingress-nginx
  ports:
    - name: http
      port: 80
      protocol: TCP
      targetPort: 80
    - name: https
      port: 443
      protocol: TCP
      targetPort: 443
  type: LoadBalancer

Apply the created file:

ka nginx-lb.yaml # with my aliases
kubectl apply -f nginx-lb.yaml # without aliases

What’s Next?

Your K3s installation is complete! You can now deploy workloads, configure services, and explore Kubernetes.

Refer to the official K3s documentation for advanced configuration and multi-node setups.