feat(jellyfin): add kubernetes manifests and migration scripts
Sync HTPC Manifests to GitOps / Sync Manifests to GitOps Repo (push) Successful in 4s

This commit is contained in:
bart
2026-11-07 10:44:11 +01:00
parent 3ab3a5f84b
commit bba3a09cfe
9 changed files with 409 additions and 0 deletions
+133
View File
@@ -0,0 +1,133 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: jellyfin
namespace: htpc
labels:
app.kubernetes.io/name: jellyfin
app.kubernetes.io/part-of: htpc
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: jellyfin
template:
metadata:
labels:
app: jellyfin
app.kubernetes.io/name: jellyfin
app.kubernetes.io/part-of: htpc
spec:
nodeSelector:
kubernetes.io/hostname: vmserver
initContainers:
- name: migrate-config
image: lscr.io/linuxserver/jellyfin:latest
imagePullPolicy: IfNotPresent
command:
- /bin/bash
- -c
- |
if [ ! -f /config/system.xml ] && [ -f /host-etc/system.xml ]; then
echo "Syncing Jellyfin configuration from /etc/jellyfin..."
cp -a /host-etc/* /config/
sed -i 's|<MetadataPath>/var/lib/jellyfin/metadata</MetadataPath>|<MetadataPath>/config/metadata</MetadataPath>|g' /config/system.xml || true
sed -i 's|<CachePath>/var/cache/jellyfin</CachePath>|<CachePath>/config/cache</CachePath>|g' /config/system.xml || true
fi
if [ ! -f /config/data/jellyfin.db ] && [ -d /host-data/data ]; then
echo "Syncing Jellyfin data, metadata, plugins and root from /var/lib/jellyfin..."
mkdir -p /config/data /config/metadata /config/plugins /config/root
[ -d /host-data/data ] && cp -a /host-data/data/* /config/data/ || true
[ -d /host-data/metadata ] && cp -a /host-data/metadata/* /config/metadata/ || true
[ -d /host-data/plugins ] && cp -a /host-data/plugins/* /config/plugins/ || true
[ -d /host-data/root ] && cp -a /host-data/root/* /config/root/ || true
fi
chown -R 33:33 /config
volumeMounts:
- name: config
mountPath: /config
- name: host-etc
mountPath: /host-etc
readOnly: true
- name: host-data
mountPath: /host-data
readOnly: true
containers:
- name: jellyfin
image: lscr.io/linuxserver/jellyfin:latest
imagePullPolicy: IfNotPresent
securityContext:
privileged: true
env:
- name: PUID
value: "33"
- name: PGID
value: "33"
- name: TZ
value: "Europe/Amsterdam"
- name: DOTNET_gcServer
value: "0"
- name: DOTNET_GCHeapHardLimit
value: "0x160000000"
- name: DOTNET_GCLargeObjectHeapCompactionMode
value: "1"
ports:
- name: http
containerPort: 8096
hostPort: 8096
resources:
requests:
cpu: 200m
memory: 1Gi
limits:
cpu: 4000m
memory: 8Gi
volumeMounts:
- name: config
mountPath: /config
- name: datadisk
mountPath: /datadisk
- name: mnt-mp3
mountPath: /mnt/mp3
- name: dri
mountPath: /dev/dri
livenessProbe:
httpGet:
path: /jellyfin/health
port: 8096
initialDelaySeconds: 60
periodSeconds: 20
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /jellyfin/health
port: 8096
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
volumes:
- name: config
persistentVolumeClaim:
claimName: jellyfin-config
- name: datadisk
hostPath:
path: /datadisk
type: Directory
- name: mnt-mp3
hostPath:
path: /mnt/mp3
type: Directory
- name: dri
hostPath:
path: /dev/dri
type: Directory
- name: host-etc
hostPath:
path: /etc/jellyfin
type: DirectoryOrCreate
- name: host-data
hostPath:
path: /var/lib/jellyfin
type: DirectoryOrCreate
+7
View File
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- pvc.yaml
- service.yaml
- deployment.yaml
+15
View File
@@ -0,0 +1,15 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: jellyfin-config
namespace: htpc
labels:
app.kubernetes.io/name: jellyfin
app.kubernetes.io/part-of: htpc
spec:
accessModes:
- ReadWriteOnce
storageClassName: local-path
resources:
requests:
storage: 30Gi
+17
View File
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: jellyfin
namespace: htpc
labels:
app.kubernetes.io/name: jellyfin
app.kubernetes.io/part-of: htpc
spec:
type: ClusterIP
ports:
- name: http
port: 8096
targetPort: 8096
protocol: TCP
selector:
app: jellyfin
+1
View File
@@ -12,5 +12,6 @@ resources:
- slskd
- jackett
- flaresolverr
- jellyfin