- Set up Kubernetes resources for Uptime Kuma deployment

Added YAML manifests to create the namespace, PersistentVolumeClaim, Deployment, Service, and Ingress for the Uptime Kuma application. Included configurations for TLS support, liveness probe, and a restore pod template for data management. These resources aim to facilitate scalable and secure application deployment.
This commit is contained in:
Guillaume "B.B." Van Hemmen 2025-01-20 18:44:35 +01:00
parent baac8956ba
commit 4563ee027e
6 changed files with 112 additions and 0 deletions

5
00-namespace.yaml Normal file
View file

@ -0,0 +1,5 @@
apiVersion: v1
kind: Namespace
metadata:
name: uptime-kuma

11
01-pvc.yaml Normal file
View file

@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
namespace: uptime-kuma
name: app-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi

35
02-deployment.yaml Normal file
View file

@ -0,0 +1,35 @@
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: uptime-kuma
name: app
spec:
selector:
matchLabels:
name: app
template:
metadata:
labels:
name: app
instance: production
component: frontend
part-of: uptime-kuma
managed-by: k8s-yaml
spec:
containers:
- name: app
image: louislam/uptime-kuma:1.23.16
ports:
- containerPort: 3001
volumeMounts:
- mountPath: /app/data
name: app-data
livenessProbe:
tcpSocket:
port: 3001
initialDelaySeconds: 5
periodSeconds: 10
volumes:
- name: app-data
persistentVolumeClaim:
claimName: app-data

13
03-service.yaml Normal file
View file

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
namespace: uptime-kuma
name: app
spec:
ports:
- port: 3001
targetPort: 3001
name: app
selector:
name: app
type: ClusterIP

25
04-ingress.yaml Normal file
View file

@ -0,0 +1,25 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
namespace: uptime-kuma
name: app-ingress
annotations:
cert-manager.io/cluster-issuer: letsencrypt-production
external-dns.alpha.kubernetes.io/hostname: status.van-hemmen.com
traefik.ingress.kubernetes.io/router.entrypoints: websecure
spec:
rules:
- host: status.van-hemmen.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: app
port:
number: 3001
tls:
- hosts:
- status.van-hemmen.com
secretName: status-app-tls

23
99-restore-pod.yaml Normal file
View file

@ -0,0 +1,23 @@
#apiVersion: v1
#kind: Pod
#metadata:
# namespace: uptime-kuma
# name: data-transfer-pod
#spec:
# containers:
# - name: transfer
# image: busybox
# command: ["sleep", "3600"]
# volumeMounts:
# - mountPath: /data
# name: data-volume
# volumes:
# - name: data-volume
# persistentVolumeClaim:
# claimName: app-data
#
##How to use
## create docker archive
## VOLUME=NAME; sudo docker run --rm -v $VOLUME:/data -v $(pwd):/backup busybox tar czf /backup/$VOLUME.tar.gz -C /data .
##copy, deflate, delete archive and list data
## VOLUME=NAME; NAMESPACE=NAME; kubectl -n $NAMESPACE exec data-transfer-pod -- rm -rf /data/*; kubectl -n $NAMESPACE cp $VOLUME.tar.gz data-transfer-pod:/data/; kubectl -n $NAMESPACE exec data-transfer-pod -- tar xzf /data/$VOLUME.tar.gz -C /data; kubectl -n $NAMESPACE exec data-transfer-pod -- rm /data/$VOLUME.tar.gz; kubectl -n $NAMESPACE exec data-transfer-pod -- ls -l /data