migrate sonarr to kubernetes

This commit is contained in:
Pim Kunis 2024-04-06 17:47:49 +02:00
parent 100af46f88
commit 81eacbcfcb
3 changed files with 115 additions and 55 deletions

View file

@ -49,61 +49,6 @@ volumes:
jellyfin_cache: jellyfin_cache:
services: services:
# prowlarr:
# image: lscr.io/linuxserver/prowlarr:latest
# environment:
# - PUID=1000
# - PGID=1000
# - TZ=Europe/Amsterdam
# volumes:
# - type: volume
# source: prowlarr_config
# target: /config
# volume:
# nocopy: true
# networks:
# - traefik
# deploy:
# labels:
# - traefik.enable=true
# - traefik.http.routers.prowlarr.entrypoints=localsecure
# - traefik.http.routers.prowlarr.rule=Host(`prowlarr.kun.is`)
# - traefik.http.routers.prowlarr.tls=true
# - traefik.http.routers.prowlarr.tls.certresolver=letsencrypt
# - traefik.http.routers.prowlarr.service=prowlarr
# - traefik.http.services.prowlarr.loadbalancer.server.port=9696
# - traefik.docker.network=traefik
sonarr:
image: lscr.io/linuxserver/sonarr:latest
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Amsterdam
volumes:
- type: volume
source: sonarr_config
target: /config
volume:
nocopy: true
- type: volume
source: media
target: /media
volume:
nocopy: true
networks:
- traefik
deploy:
labels:
- traefik.enable=true
- traefik.http.routers.sonarr.entrypoints=localsecure
- traefik.http.routers.sonarr.rule=Host(`sonarr.kun.is`)
- traefik.http.routers.sonarr.tls=true
- traefik.http.routers.sonarr.tls.certresolver=letsencrypt
- traefik.http.routers.sonarr.service=sonarr
- traefik.http.services.sonarr.loadbalancer.server.port=8989
- traefik.docker.network=traefik
bazarr: bazarr:
image: lscr.io/linuxserver/bazarr:latest image: lscr.io/linuxserver/bazarr:latest
environment: environment:

View file

@ -150,6 +150,12 @@ services:
- traefik.http.routers.prowlarr.rule=Host(`prowlarr.kun.is`) - traefik.http.routers.prowlarr.rule=Host(`prowlarr.kun.is`)
- traefik.http.routers.prowlarr.tls=true - traefik.http.routers.prowlarr.tls=true
- traefik.http.routers.prowlarr.tls.certresolver=letsencrypt - traefik.http.routers.prowlarr.tls.certresolver=letsencrypt
- traefik.http.routers.sonarr.entrypoints=localsecure
- traefik.http.routers.sonarr.service=k3s@file
- traefik.http.routers.sonarr.rule=Host(`sonarr.kun.is`)
- traefik.http.routers.sonarr.tls=true
- traefik.http.routers.sonarr.tls.certresolver=letsencrypt
volumes: volumes:
- type: bind - type: bind
source: /var/run/docker.sock source: /var/run/docker.sock

View file

@ -24,6 +24,12 @@
PGID = "1000"; PGID = "1000";
TZ = "Europe/Amsterdam"; TZ = "Europe/Amsterdam";
}; };
sonarr-env.data = {
PUID = "1000";
PGID = "1000";
TZ = "Europe/Amsterdam";
};
}; };
deployments = { deployments = {
@ -285,6 +291,61 @@
}; };
}; };
}; };
sonarr = {
metadata.labels = {
app = "media";
component = "sonarr";
};
spec = {
selector.matchLabels = {
app = "media";
component = "sonarr";
};
template = {
metadata.labels = {
app = "media";
component = "sonarr";
};
spec = {
containers.sonarr = {
image = "lscr.io/linuxserver/sonarr:latest";
envFrom = [{ configMapRef.name = "sonarr-env"; }];
ports = [{
containerPort = 8989;
protocol = "TCP";
}];
volumeMounts = [
{
name = "config";
mountPath = "/config";
}
{
name = "media";
mountPath = "/media";
}
];
};
volumes = [
{
name = "config";
persistentVolumeClaim.claimName = "sonarr-config";
}
{
name = "media";
persistentVolumeClaim.claimName = "media";
}
];
};
};
};
};
}; };
persistentVolumes = { persistentVolumes = {
@ -347,6 +408,16 @@
path = "/mnt/data/nfs/prowlarr/config"; path = "/mnt/data/nfs/prowlarr/config";
}; };
}; };
sonarr-config.spec = {
capacity.storage = "1Mi";
accessModes = [ "ReadWriteMany" ];
nfs = {
server = "lewis.hyp";
path = "/mnt/data/nfs/sonarr/config";
};
};
}; };
persistentVolumeClaims = { persistentVolumeClaims = {
@ -391,6 +462,13 @@
resources.requests.storage = "1Mi"; resources.requests.storage = "1Mi";
volumeName = "prowlarr-config"; volumeName = "prowlarr-config";
}; };
sonarr-config.spec = {
accessModes = [ "ReadWriteMany" ];
storageClassName = "";
resources.requests.storage = "1Mi";
volumeName = "sonarr-config";
};
}; };
services = { services = {
@ -474,6 +552,19 @@
targetPort = 9696; targetPort = 9696;
}]; }];
}; };
sonarr.spec = {
selector = {
app = "media";
component = "sonarr";
};
ports = [{
protocol = "TCP";
port = 80;
targetPort = 8989;
}];
};
}; };
ingresses = { ingresses = {
@ -566,6 +657,24 @@
}]; }];
}]; }];
}; };
sonarr.spec = {
ingressClassName = "traefik";
rules = [{
host = "sonarr.kun.is";
http.paths = [{
path = "/";
pathType = "Prefix";
backend.service = {
name = "sonarr";
port.number = 80;
};
}];
}];
};
}; };
}; };
} }