migrate jellyfin to kubernetes

This commit is contained in:
Pim Kunis 2024-04-06 16:15:01 +02:00
parent d858f88681
commit 9e92c85277
4 changed files with 136 additions and 34 deletions

View file

@ -49,40 +49,6 @@ volumes:
jellyfin_cache:
services:
jellyfin:
image: jellyfin/jellyfin:10.8.13-1
network_mode: 'host'
volumes:
- jellyfin_cache:/cache
- type: volume
source: jellyfin_config
target: /config
volume:
nocopy: true
- type: volume
source: media
target: /media
volume:
nocopy: true
# Alternative address used for autodiscovery
environment:
- JELLYFIN_PublishedServerUrl=http://media.kun.is:444
# Optional - may be necessary for docker healthcheck to pass if running in host network mode
# extra_hosts:
# - "host.docker.internal:host-gateway"
networks:
- traefik
deploy:
labels:
- traefik.enable=true
- traefik.http.routers.jellyfin.entrypoints=websecure
- traefik.http.routers.jellyfin.rule=Host(`media.kun.is`)
- traefik.http.routers.jellyfin.tls=true
- traefik.http.routers.jellyfin.tls.certresolver=letsencrypt
- traefik.http.routers.jellyfin.service=jellyfin
- traefik.http.services.jellyfin.loadbalancer.server.port=8096
- traefik.docker.network=traefik
transmission:
image: lscr.io/linuxserver/transmission:latest
ports:

View file

@ -120,6 +120,12 @@ services:
- traefik.http.routers.forgejo.rule=Host(`git.kun.is`)
- traefik.http.routers.forgejo.tls=true
- traefik.http.routers.forgejo.tls.certresolver=letsencrypt
- traefik.http.routers.jellyfin.entrypoints=websecure
- traefik.http.routers.jellyfin.service=k3s@file
- traefik.http.routers.jellyfin.rule=Host(`media.kun.is`)
- traefik.http.routers.jellyfin.tls=true
- traefik.http.routers.jellyfin.tls.certresolver=letsencrypt
volumes:
- type: bind
source: /var/run/docker.sock

View file

@ -19,6 +19,7 @@
./paperless-ngx.nix
./kitchenowl.nix
./forgejo.nix
./media.nix
];
kubernetes.kubeconfig = "~/.kube/config";
kubenix.project = "home";

129
nix/flake/kubenix/media.nix Normal file
View file

@ -0,0 +1,129 @@
{
kubernetes.resources = {
configMaps.jellyfin-env.data.JELLYFIN_PublishedServerUrl = "https://media.kun.is";
deployments.jellyfin = {
metadata.labels = {
app = "media";
component = "jellyfin";
};
spec = {
selector.matchLabels = {
app = "media";
component = "jellyfin";
};
template = {
metadata.labels = {
app = "media";
component = "jellyfin";
};
spec = {
containers.jellyfin = {
image = "jellyfin/jellyfin:10.8.13-1";
envFrom = [{ configMapRef.name = "jellyfin-env"; }];
ports = [{
containerPort = 8096;
protocol = "TCP";
}];
volumeMounts = [
{
name = "config";
mountPath = "/config";
}
{
name = "media";
mountPath = "/media";
}
];
};
volumes = [
{
name = "config";
persistentVolumeClaim.claimName = "jellyfin-config";
}
{
name = "media";
persistentVolumeClaim.claimName = "media";
}
];
};
};
};
};
persistentVolumes = {
jellyfin-config.spec = {
capacity.storage = "1Mi";
accessModes = [ "ReadWriteMany" ];
nfs = {
server = "lewis.hyp";
path = "/mnt/data/nfs/jellyfin/config";
};
};
media.spec = {
capacity.storage = "1Mi";
accessModes = [ "ReadWriteMany" ];
nfs = {
server = "lewis.hyp";
path = "/mnt/data/nfs/media";
};
};
};
persistentVolumeClaims = {
jellyfin-config.spec = {
accessModes = [ "ReadWriteMany" ];
storageClassName = "";
resources.requests.storage = "1Mi";
volumeName = "jellyfin-config";
};
media.spec = {
accessModes = [ "ReadWriteMany" ];
storageClassName = "";
resources.requests.storage = "1Mi";
volumeName = "media";
};
};
services.jellyfin.spec = {
selector = {
app = "media";
component = "jellyfin";
};
ports = [{
protocol = "TCP";
port = 80;
targetPort = 8096;
}];
};
ingresses.jellyfin.spec = {
ingressClassName = "traefik";
rules = [{
host = "media.kun.is";
http.paths = [{
path = "/";
pathType = "Prefix";
backend.service = {
name = "jellyfin";
port.number = 80;
};
}];
}];
};
};
}