How to Set Up Uptime Kuma on a k3s Kubernetes Cluster

Discover how to set up Uptime Kuma on a k3s Kubernetes cluster with this step-by-step guide. Utilize MetalLB for local IP assignment, create necessary YAML configuration files, and deploy Uptime Kuma. Monitor your services efficiently on your local network.

How to Set Up Uptime Kuma on a k3s Kubernetes Cluster

In this article, I'll explain how to set up Uptime Kuma on a k3s Kubernetes cluster. I'll be using MetalLB on my k3s cluster to assign LAN IP addresses. You can check out my article explaining how to do this:

Simplifying Local Network IP Assignment for Kubernetes with MetalLB
Learn to assign local network IPs to Kubernetes deployments using MetalLB. This step-by-step guide makes network load balancing easy, perfect for developers and IT pros seeking straightforward IP management without relying on cloud providers.

Prerequisites

Before you begin, ensure you have the following:

  • A running k3s Kubernetes cluster.
  • MetalLB installed and configured on your k3s cluster to assign LAN IP addresses. Refer to my MetalLB article for detailed steps.

Step 1: Create Configuration Files

First, create a directory for your Uptime Kuma configurations. Inside this directory, you will create three YAML files:

  1. uptime-kuma-loadbalancer.yaml
  2. uptime-kuma-pvc.yaml
  3. uptime-kuma.yaml

1. uptime-kuma-loadbalancer.yaml

This file defines a LoadBalancer service to expose Uptime Kuma on your local network.

apiVersion: v1
kind: Service
metadata:
  name: uptime-lb
spec:
  selector:
    app: uptime-kuma
  ports:
    - port: 3001
      targetPort: 3001
  type: LoadBalancer
  loadBalancerIP: 192.168.2.210

2. uptime-kuma-pvc.yaml

This file defines a PersistentVolumeClaim to provide storage for Uptime Kuma.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: uptime-kuma-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

3. uptime-kuma.yaml

This file defines the Uptime Kuma deployment.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: uptime-kuma
  labels:
    app: uptime-kuma
spec:
  replicas: 1
  selector:
    matchLabels:
      app: uptime-kuma
  template:
    metadata:
      labels:
        app: uptime-kuma
    spec:
      containers:
        - name: uptime-kuma
          image: louislam/uptime-kuma:latest
          ports:
            - containerPort: 3001
          volumeMounts:
            - name: kuma-volume
              mountPath: /app/data
      volumes:
        - name: kuma-volume
          persistentVolumeClaim:
            claimName: uptime-kuma-pvc

Step 2: Apply the Configurations

Open a terminal in the directory containing your YAML files and run the following command to apply all configurations:

kubectl apply -f ./

Step 3: Verify the Deployment

Check the status of your deployment to ensure everything is running correctly:

Kubectl get all -o wide

Accessing Uptime Kuma

Once your deployment is running, you should be able to access Uptime Kuma on your local network at http://192.168.2.210:3001.