Umami is a free and open source analytics tool as a Google Analytics instead. It can be hosted on K8s easily.
K8s Deployment Config for Umami
kind: Deployment
apiVersion: apps/v1
metadata:
name: umami
labels:
app: umami
tier: backend
spec:
replicas: 1
selector:
matchLabels:
app: umami
tier: backend
template:
metadata:
labels:
app: umami
tier: backend
spec:
nodeSelector:
kubernetes.io/arch: amd64
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- umami
topologyKey: "kubernetes.io/hostname"
containers:
- name: umami
image: ghcr.io/mikecao/umami:postgresql-b756fcd
ports:
- containerPort: 3000
env:
- name: DATABASE_TYPE
value: postgresql
- name: HASH_SALT
valueFrom:
secretKeyRef:
name: default-secrets
key: umami-hashsalt
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: default-secrets
key: umami-db-url
---
apiVersion: v1
kind: Service
metadata:
name: umami
labels:
app: umami
tier: backend
spec:
ports:
- name: http
port: 3000
selector:
app: umami
tier: backend
---
kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: umami
labels:
app: umami
tier: backend
annotations:
kubernetes.io/ingress.class: traefik
cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
rules:
- host: umami.mydomain.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: umami
port:
number: 3000
tls:
- hosts:
- umami.mydomain.com
secretName: cert-tls
This config requires a container from ghcr, the github container registry, not from the default docker hub.