migrate transmission to kubernetes

This commit is contained in:
Pim Kunis 2024-04-06 16:45:10 +02:00
parent 9e92c85277
commit 6361b06a5a
3 changed files with 198 additions and 85 deletions

View file

@ -49,39 +49,6 @@ volumes:
jellyfin_cache:
services:
transmission:
image: lscr.io/linuxserver/transmission:latest
ports:
- "{{ bittorrent_port }}:{{ bittorrent_port }}"
- "{{ bittorrent_port }}:{{ bittorrent_port }}/udp"
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Amsterdam
volumes:
- type: volume
source: transmission_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.transmission.entrypoints=localsecure
- traefik.http.routers.transmission.rule=Host(`transmission.kun.is`)
- traefik.http.routers.transmission.tls=true
- traefik.http.routers.transmission.tls.certresolver=letsencrypt
- traefik.http.routers.transmission.service=transmission
- traefik.http.services.transmission.loadbalancer.server.port=9091
- traefik.docker.network=traefik
jellyseerr:
image: fallenbagel/jellyseerr:1.7.0
environment:

View file

@ -126,6 +126,12 @@ services:
- 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.transmission.entrypoints=localsecure
- traefik.http.routers.transmission.service=k3s@file
- traefik.http.routers.transmission.rule=Host(`transmission.kun.is`)
- traefik.http.routers.transmission.tls=true
- traefik.http.routers.transmission.tls.certresolver=letsencrypt
volumes:
- type: bind
source: /var/run/docker.sock

View file

@ -1,8 +1,16 @@
{
kubernetes.resources = {
configMaps.jellyfin-env.data.JELLYFIN_PublishedServerUrl = "https://media.kun.is";
configMaps = {
jellyfin-env.data.JELLYFIN_PublishedServerUrl = "https://media.kun.is";
transmission-env.data = {
PUID = "1000";
PGID = "1000";
TZ = "Europe/Amsterdam";
};
};
deployments.jellyfin = {
deployments = {
jellyfin = {
metadata.labels = {
app = "media";
component = "jellyfin";
@ -57,6 +65,70 @@
};
};
transmission = {
metadata.labels = {
app = "media";
component = "transmission";
};
spec = {
selector.matchLabels = {
app = "media";
component = "transmission";
};
template = {
metadata.labels = {
app = "media";
component = "transmission";
};
spec = {
containers.transmission = {
image = "lscr.io/linuxserver/transmission:latest";
envFrom = [{ configMapRef.name = "transmission-env"; }];
ports = [
{
containerPort = 9091;
protocol = "TCP";
}
# TODO: Only use TCP, as Kubernetes does not support multiple protocols for a port number.
# Should see if this works as correctly though.
{
containerPort = 31780;
protocol = "TCP";
}
];
volumeMounts = [
{
name = "config";
mountPath = "/config";
}
{
name = "media";
mountPath = "/media";
}
];
};
volumes = [
{
name = "config";
persistentVolumeClaim.claimName = "transmission-config";
}
{
name = "media";
persistentVolumeClaim.claimName = "media";
}
];
};
};
};
};
};
persistentVolumes = {
jellyfin-config.spec = {
capacity.storage = "1Mi";
@ -77,6 +149,16 @@
path = "/mnt/data/nfs/media";
};
};
transmission-config.spec = {
capacity.storage = "1Mi";
accessModes = [ "ReadWriteMany" ];
nfs = {
server = "lewis.hyp";
path = "/mnt/data/nfs/transmission/config";
};
};
};
persistentVolumeClaims = {
@ -93,9 +175,17 @@
resources.requests.storage = "1Mi";
volumeName = "media";
};
transmission-config.spec = {
accessModes = [ "ReadWriteMany" ];
storageClassName = "";
resources.requests.storage = "1Mi";
volumeName = "transmission-config";
};
};
services.jellyfin.spec = {
services = {
jellyfin.spec = {
selector = {
app = "media";
component = "jellyfin";
@ -108,7 +198,38 @@
}];
};
ingresses.jellyfin.spec = {
transmission-web.spec = {
selector = {
app = "media";
component = "transmission";
};
ports = [{
protocol = "TCP";
port = 80;
targetPort = 9091;
}];
};
transmission-bittorrent.spec = {
type = "LoadBalancer";
loadBalancerIP = "192.168.30.133";
selector = {
app = "media";
component = "transmission";
};
ports = [{
protocol = "TCP";
port = 31780;
targetPort = 31780;
}];
};
};
ingresses = {
jellyfin.spec = {
ingressClassName = "traefik";
rules = [{
@ -125,5 +246,24 @@
}];
}];
};
transmission.spec = {
ingressClassName = "traefik";
rules = [{
host = "transmission.kun.is";
http.paths = [{
path = "/";
pathType = "Prefix";
backend.service = {
name = "transmission-web";
port.number = 80;
};
}];
}];
};
};
};
}