homelab/manifests/core/glances.yaml
Nik Afiq d44295f569 fix: add resource requests/limits and probes to workloads that had none
Stage 7 of REFACTOR_PLAN.md (findings #16). Covers dashy, glances,
ca-installer, authentik-proxy-outpost, jellyfin, qbittorrent/jdownloader main
containers (their gluetun sidecars already had probes), and all 4 Immich
Deployments -- previously none of these had any protection against one
workload starving another on this fixed-capacity cluster, nor automatic
restart on hang.

Values are sized from live `kubectl top pod` baselines gathered this session
(not guessed): e.g. Jellyfin/Immich-server were observed at ~3.1-3.3Gi
resident, so their limits give headroom above that (4Gi) rather than an
arbitrary round number. Used tcpSocket probes instead of httpGet wherever I
wasn't certain of an app's exact health-check path (Immich, Postgres/Redis),
to avoid a wrong path causing false probe failures on a live service.

This is Kubernetes-native and takes effect on next pod restart, but should
still be rolled out watching `kubectl top`/restart counts rather than pushed
and forgotten -- limits set too low can OOMKill under real load.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-23 18:21:03 +09:00

113 lines
2.5 KiB
YAML

# Apply: kubectl apply -f manifests/core/glances.yaml
# Delete: kubectl delete -f manifests/core/glances.yaml
# Description: Glances system monitoring DaemonSet with Ingress at glances.home.arpa.
apiVersion: v1
kind: Namespace
metadata:
name: glances
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: glances
namespace: glances
spec:
selector:
matchLabels:
app: glances
template:
metadata:
labels:
app: glances
spec:
nodeSelector:
node-role: primary
hostPID: true
hostNetwork: true
containers:
- name: glances
image: nicolargo/glances:latest-full
ports:
- containerPort: 61208
env:
- name: GLANCES_OPT
value: "-w"
securityContext:
privileged: true
readinessProbe:
tcpSocket:
port: 61208
initialDelaySeconds: 10
periodSeconds: 15
livenessProbe:
tcpSocket:
port: 61208
initialDelaySeconds: 20
periodSeconds: 30
resources:
requests:
cpu: 50m
memory: 128Mi
limits:
cpu: 300m
memory: 256Mi
volumeMounts:
- name: host-proc
mountPath: /proc
readOnly: true
- name: host-sys
mountPath: /sys
readOnly: true
- name: host-etc
mountPath: /etc/glances
readOnly: true
volumes:
- name: host-proc
hostPath:
path: /proc
- name: host-sys
hostPath:
path: /sys
- name: host-etc
hostPath:
path: /etc
---
apiVersion: v1
kind: Service
metadata:
name: glances
namespace: glances
spec:
selector:
app: glances
ports:
- port: 61208
targetPort: 61208
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: glances
namespace: glances
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.tls: "true"
cert-manager.io/cluster-issuer: internal-ca-issuer
spec:
ingressClassName: traefik
tls:
- secretName: glances-tls
hosts:
- glances.home.arpa
rules:
- host: glances.home.arpa
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: glances
port:
number: 61208