homelab/manifests/media/jellyfin.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

175 lines
3.9 KiB
YAML

# Apply: kubectl apply -f manifests/media/jellyfin.yaml
# Delete: kubectl delete -f manifests/media/jellyfin.yaml
# Description: Jellyfin media server with NFS media PV, local config PVC, and Ingress at jellyfin.home.arpa.
apiVersion: v1
kind: Namespace
metadata:
name: jellyfin
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: jellyfin-media-pv
spec:
capacity:
storage: 10Ti
accessModes:
- ReadOnlyMany
persistentVolumeReclaimPolicy: Retain
nfs:
server: 192.168.7.183
path: /mnt/storage
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- minisforum
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: jellyfin-media
namespace: jellyfin
annotations:
helm.sh/resource-policy: keep
spec:
accessModes:
- ReadOnlyMany
storageClassName: ""
volumeName: jellyfin-media-pv
resources:
requests:
storage: 10Ti
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: jellyfin-config
namespace: jellyfin
annotations:
helm.sh/resource-policy: keep
spec:
accessModes:
- ReadWriteOnce
storageClassName: local-path
resources:
requests:
storage: 10Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: jellyfin
namespace: jellyfin
spec:
replicas: 1
selector:
matchLabels:
app: jellyfin
template:
metadata:
labels:
app: jellyfin
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node-role
operator: In
values:
- primary
containers:
- name: jellyfin
image: jellyfin/jellyfin:latest
ports:
- containerPort: 8096
env:
- name: JELLYFIN_PublishedServerUrl
value: https://jellyfin.home.arpa
- name: LIBVA_DRIVER_NAME
value: radeonsi
readinessProbe:
httpGet:
path: /health
port: 8096
initialDelaySeconds: 15
periodSeconds: 15
livenessProbe:
httpGet:
path: /health
port: 8096
initialDelaySeconds: 30
periodSeconds: 30
resources:
requests:
cpu: 200m
memory: 1Gi
limits:
cpu: 2000m
memory: 4Gi
volumeMounts:
- name: config
mountPath: /config
- name: media
mountPath: /media
readOnly: true
- name: dri
mountPath: /dev/dri
securityContext:
supplementalGroups:
- 992
volumes:
- name: config
persistentVolumeClaim:
claimName: jellyfin-config
- name: media
persistentVolumeClaim:
claimName: jellyfin-media
- name: dri
hostPath:
path: /dev/dri
---
apiVersion: v1
kind: Service
metadata:
name: jellyfin
namespace: jellyfin
spec:
selector:
app: jellyfin
ports:
- port: 80
targetPort: 8096
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: jellyfin
namespace: jellyfin
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: jellyfin-tls
hosts:
- jellyfin.home.arpa
rules:
- host: jellyfin.home.arpa
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: jellyfin
port:
number: 80