add the media stack
This commit is contained in:
160
base/vpn/dispatcharr-vpn.yaml
Normal file
160
base/vpn/dispatcharr-vpn.yaml
Normal file
@@ -0,0 +1,160 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: dispatcharr
|
||||
namespace: media
|
||||
labels:
|
||||
app: dispatcharr
|
||||
app.kubernetes.io/name: dispatcharr
|
||||
app.kubernetes.io/component: iptv-proxy
|
||||
vpn: "true"
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: dispatcharr
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: dispatcharr
|
||||
vpn: "true"
|
||||
spec:
|
||||
containers:
|
||||
# Gluetun VPN Sidecar
|
||||
- name: gluetun
|
||||
image: qmcgaw/gluetun:latest
|
||||
securityContext:
|
||||
capabilities:
|
||||
add:
|
||||
- NET_ADMIN
|
||||
env:
|
||||
- name: TZ
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: media-config
|
||||
key: TZ
|
||||
- name: WIREGUARD_PRIVATE_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: mullvad-vpn
|
||||
key: WIREGUARD_PRIVATE_KEY
|
||||
- name: WIREGUARD_ADDRESSES
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: mullvad-vpn
|
||||
key: WIREGUARD_ADDRESSES
|
||||
# Dispatcharr needs to serve streams to Jellyfin inside cluster
|
||||
- name: FIREWALL_OUTBOUND_SUBNETS
|
||||
value: "10.0.0.0/24,10.96.0.0/12"
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: gluetun-config
|
||||
volumeMounts:
|
||||
- name: tun-device
|
||||
mountPath: /dev/net/tun
|
||||
- name: gluetun-data
|
||||
mountPath: /gluetun
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 9191
|
||||
protocol: TCP
|
||||
- name: http-proxy
|
||||
containerPort: 8888
|
||||
protocol: TCP
|
||||
resources:
|
||||
requests:
|
||||
memory: "128Mi"
|
||||
cpu: "50m"
|
||||
limits:
|
||||
memory: "512Mi"
|
||||
cpu: "500m"
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /gluetun-entrypoint
|
||||
- healthcheck
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 10
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /gluetun-entrypoint
|
||||
- healthcheck
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
|
||||
# Dispatcharr
|
||||
- name: dispatcharr
|
||||
image: ghcr.io/dispatcharr/dispatcharr:latest
|
||||
env:
|
||||
- name: DISPATCHARR_ENV
|
||||
value: "aio"
|
||||
- name: REDIS_HOST
|
||||
value: "localhost"
|
||||
- name: CELERY_BROKER_URL
|
||||
value: "redis://localhost:6379/0"
|
||||
- name: DISPATCHARR_LOG_LEVEL
|
||||
value: "info"
|
||||
- name: TZ
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: media-config
|
||||
key: TZ
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /data
|
||||
subPath: dispatcharr
|
||||
resources:
|
||||
requests:
|
||||
memory: "256Mi"
|
||||
cpu: "100m"
|
||||
limits:
|
||||
memory: "1Gi"
|
||||
cpu: "500m"
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: 9191
|
||||
initialDelaySeconds: 90
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 10
|
||||
readinessProbe:
|
||||
tcpSocket:
|
||||
port: 9191
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
|
||||
volumes:
|
||||
- name: tun-device
|
||||
hostPath:
|
||||
path: /dev/net/tun
|
||||
type: CharDevice
|
||||
- name: gluetun-data
|
||||
emptyDir: {}
|
||||
- name: config
|
||||
persistentVolumeClaim:
|
||||
claimName: media-config
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: dispatcharr
|
||||
namespace: media
|
||||
labels:
|
||||
app: dispatcharr
|
||||
spec:
|
||||
type: NodePort
|
||||
selector:
|
||||
app: dispatcharr
|
||||
ports:
|
||||
- name: http
|
||||
port: 9191
|
||||
targetPort: 9191
|
||||
nodePort: 30191
|
||||
protocol: TCP
|
||||
47
base/vpn/gluetun-config.yaml
Normal file
47
base/vpn/gluetun-config.yaml
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
# Gluetun VPN Configuration
|
||||
# Shared configuration for all pods using Gluetun sidecar
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: gluetun-config
|
||||
namespace: media
|
||||
labels:
|
||||
app.kubernetes.io/name: media-stack
|
||||
app.kubernetes.io/component: vpn
|
||||
data:
|
||||
# VPN Provider
|
||||
VPN_SERVICE_PROVIDER: "mullvad"
|
||||
VPN_TYPE: "wireguard"
|
||||
|
||||
# Server selection - adjust to your preferred location
|
||||
# Options: See https://github.com/qdm12/gluetun-wiki/blob/main/setup/servers.md
|
||||
# Examples: "London", "Amsterdam", "New York City", "Stockholm"
|
||||
SERVER_CITIES: "London"
|
||||
|
||||
# Kill switch - blocks all traffic if VPN drops (highly recommended)
|
||||
FIREWALL: "on"
|
||||
|
||||
# DNS over TLS for privacy
|
||||
DOT: "on"
|
||||
|
||||
# Block malicious domains
|
||||
BLOCK_MALICIOUS: "on"
|
||||
BLOCK_SURVEILLANCE: "on"
|
||||
BLOCK_ADS: "off"
|
||||
|
||||
# Health check settings
|
||||
HEALTH_VPN_DURATION_INITIAL: "30s"
|
||||
HEALTH_VPN_DURATION_ADDITION: "5s"
|
||||
|
||||
# Logging
|
||||
LOG_LEVEL: "info"
|
||||
|
||||
# HTTP Proxy (optional - can be used by other apps)
|
||||
HTTPPROXY: "on"
|
||||
HTTPPROXY_LOG: "off"
|
||||
|
||||
# Firewall input ports - for qBittorrent incoming connections
|
||||
# If you have Mullvad port forwarding enabled, set this to your forwarded port
|
||||
# Get a port at: https://mullvad.net/en/account/ports
|
||||
# FIREWALL_VPN_INPUT_PORTS: "12345"
|
||||
35
base/vpn/mullvad-secret.yaml
Normal file
35
base/vpn/mullvad-secret.yaml
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
# Mullvad VPN Secret
|
||||
#
|
||||
# IMPORTANT: You must fill in your Mullvad WireGuard credentials before applying!
|
||||
#
|
||||
# To get these values:
|
||||
# 1. Go to https://mullvad.net/en/account/wireguard-config
|
||||
# 2. Generate a new WireGuard configuration
|
||||
# 3. Download and extract the .conf file
|
||||
# 4. Copy the PrivateKey and Address values from the [Interface] section
|
||||
#
|
||||
# Example .conf file contents:
|
||||
# [Interface]
|
||||
# PrivateKey = wOEI9rqqbDwnN8/Bpp22sVz48T71vJ4fYmFWujulwUU=
|
||||
# Address = 10.64.222.21/32,fc00:bbbb:bbbb:bb01::1/128
|
||||
#
|
||||
# Use the PrivateKey value for WIREGUARD_PRIVATE_KEY
|
||||
# Use the IPv4 Address (first one, e.g., 10.64.222.21/32) for WIREGUARD_ADDRESSES
|
||||
#
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: mullvad-vpn
|
||||
namespace: media
|
||||
labels:
|
||||
app.kubernetes.io/name: media-stack
|
||||
app.kubernetes.io/component: vpn
|
||||
type: Opaque
|
||||
stringData:
|
||||
# Your WireGuard private key from the Mullvad config file
|
||||
# DO NOT use the key shown on the Mullvad website - it must come from the .conf file
|
||||
WIREGUARD_PRIVATE_KEY: "123abv..."
|
||||
|
||||
# Your WireGuard address from the Mullvad config file (IPv4 only, with /32)
|
||||
WIREGUARD_ADDRESSES: "10.1.1.200/32"
|
||||
152
base/vpn/prowlarr-vpn.yaml
Normal file
152
base/vpn/prowlarr-vpn.yaml
Normal file
@@ -0,0 +1,152 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: prowlarr
|
||||
namespace: media
|
||||
labels:
|
||||
app: prowlarr
|
||||
app.kubernetes.io/name: prowlarr
|
||||
app.kubernetes.io/component: indexer-management
|
||||
vpn: "true"
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: prowlarr
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: prowlarr
|
||||
vpn: "true"
|
||||
spec:
|
||||
containers:
|
||||
# Gluetun VPN Sidecar
|
||||
- name: gluetun
|
||||
image: qmcgaw/gluetun:latest
|
||||
securityContext:
|
||||
capabilities:
|
||||
add:
|
||||
- NET_ADMIN
|
||||
env:
|
||||
- name: TZ
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: media-config
|
||||
key: TZ
|
||||
- name: WIREGUARD_PRIVATE_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: mullvad-vpn
|
||||
key: WIREGUARD_PRIVATE_KEY
|
||||
- name: WIREGUARD_ADDRESSES
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: mullvad-vpn
|
||||
key: WIREGUARD_ADDRESSES
|
||||
# Prowlarr needs to reach other *arr apps inside cluster
|
||||
# Add cluster network to firewall outbound subnets
|
||||
- name: FIREWALL_OUTBOUND_SUBNETS
|
||||
value: "10.0.0.0/24,10.96.0.0/12"
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: gluetun-config
|
||||
volumeMounts:
|
||||
- name: tun-device
|
||||
mountPath: /dev/net/tun
|
||||
- name: gluetun-data
|
||||
mountPath: /gluetun
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 9696
|
||||
protocol: TCP
|
||||
- name: http-proxy
|
||||
containerPort: 8888
|
||||
protocol: TCP
|
||||
resources:
|
||||
requests:
|
||||
memory: "128Mi"
|
||||
cpu: "50m"
|
||||
limits:
|
||||
memory: "512Mi"
|
||||
cpu: "500m"
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /gluetun-entrypoint
|
||||
- healthcheck
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 10
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /gluetun-entrypoint
|
||||
- healthcheck
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
|
||||
# Prowlarr
|
||||
- name: prowlarr
|
||||
image: lscr.io/linuxserver/prowlarr:latest
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: media-config
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /config
|
||||
subPath: prowlarr
|
||||
resources:
|
||||
requests:
|
||||
memory: "128Mi"
|
||||
cpu: "50m"
|
||||
limits:
|
||||
memory: "512Mi"
|
||||
cpu: "500m"
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /ping
|
||||
port: 9696
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 10
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /ping
|
||||
port: 9696
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
|
||||
volumes:
|
||||
- name: tun-device
|
||||
hostPath:
|
||||
path: /dev/net/tun
|
||||
type: CharDevice
|
||||
- name: gluetun-data
|
||||
emptyDir: {}
|
||||
- name: config
|
||||
persistentVolumeClaim:
|
||||
claimName: media-config
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: prowlarr
|
||||
namespace: media
|
||||
labels:
|
||||
app: prowlarr
|
||||
spec:
|
||||
type: NodePort
|
||||
selector:
|
||||
app: prowlarr
|
||||
ports:
|
||||
- name: http
|
||||
port: 9696
|
||||
targetPort: 9696
|
||||
nodePort: 30696
|
||||
protocol: TCP
|
||||
17
base/vpn/qbittorrent-init-configmap.yaml
Normal file
17
base/vpn/qbittorrent-init-configmap.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
apiVersion: v1
|
||||
data:
|
||||
qbittorrent-init.sh: |+
|
||||
#!/bin/bash
|
||||
# Wait for config file to exist
|
||||
while [ ! -f /config/qBittorrent/qBittorrent.conf ]; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Add WebUI settings if they don't exist
|
||||
grep -q "WebUI\\CSRFProtection" /config/qBittorrent/qBittorrent.conf || \
|
||||
sed -i '/^\[Preferences\]/a WebUI\\CSRFProtection=false\nWebUI\\ClickjackingProtection=false\nWebUI\\HostHeaderValidation=false\nWebUI\\LocalHostAuth=false' /config/qBittorrent/qBittorrent.conf
|
||||
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: qbittorrent-init-script
|
||||
namespace: media
|
||||
173
base/vpn/qbittorrent-vpn.yaml
Normal file
173
base/vpn/qbittorrent-vpn.yaml
Normal file
@@ -0,0 +1,173 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: qbittorrent
|
||||
namespace: media
|
||||
labels:
|
||||
app: qbittorrent
|
||||
app.kubernetes.io/name: qbittorrent
|
||||
app.kubernetes.io/component: download-client
|
||||
vpn: "true"
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: qbittorrent
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: qbittorrent
|
||||
vpn: "true"
|
||||
spec:
|
||||
containers:
|
||||
# Gluetun VPN Sidecar - MUST be first container
|
||||
- name: gluetun
|
||||
image: qmcgaw/gluetun:latest
|
||||
securityContext:
|
||||
capabilities:
|
||||
add:
|
||||
- NET_ADMIN
|
||||
env:
|
||||
- name: TZ
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: media-config
|
||||
key: TZ
|
||||
# Mullvad credentials from secret
|
||||
- name: WIREGUARD_PRIVATE_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: mullvad-vpn
|
||||
key: WIREGUARD_PRIVATE_KEY
|
||||
- name: WIREGUARD_ADDRESSES
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: mullvad-vpn
|
||||
key: WIREGUARD_ADDRESSES
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: gluetun-config
|
||||
# Gluetun needs /dev/net/tun
|
||||
volumeMounts:
|
||||
- name: tun-device
|
||||
mountPath: /dev/net/tun
|
||||
- name: gluetun-data
|
||||
mountPath: /gluetun
|
||||
ports:
|
||||
# All ports must be on Gluetun container since it owns the network
|
||||
- name: http
|
||||
containerPort: 8080
|
||||
protocol: TCP
|
||||
- name: torrent-tcp
|
||||
containerPort: 6881
|
||||
protocol: TCP
|
||||
- name: torrent-udp
|
||||
containerPort: 6881
|
||||
protocol: UDP
|
||||
- name: http-proxy
|
||||
containerPort: 8888
|
||||
protocol: TCP
|
||||
resources:
|
||||
requests:
|
||||
memory: "128Mi"
|
||||
cpu: "50m"
|
||||
limits:
|
||||
memory: "512Mi"
|
||||
cpu: "500m"
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /gluetun-entrypoint
|
||||
- healthcheck
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 10
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /gluetun-entrypoint
|
||||
- healthcheck
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
|
||||
# qBittorrent - uses Gluetun's network namespace
|
||||
- name: qbittorrent
|
||||
image: lscr.io/linuxserver/qbittorrent:latest
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: media-config
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /config
|
||||
subPath: qbittorrent
|
||||
- name: downloads
|
||||
mountPath: /downloads
|
||||
- name: init-script
|
||||
mountPath: /custom-cont-init.d/qbittorrent-init.sh
|
||||
subPath: qbittorrent-init.sh
|
||||
resources:
|
||||
requests:
|
||||
memory: "256Mi"
|
||||
cpu: "100m"
|
||||
limits:
|
||||
memory: "1Gi"
|
||||
cpu: "1000m"
|
||||
# Note: No ports here - they're on the gluetun container
|
||||
# Health check via localhost since we share network namespace
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 8080
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 10
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 8080
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
|
||||
volumes:
|
||||
- name: tun-device
|
||||
hostPath:
|
||||
path: /dev/net/tun
|
||||
type: CharDevice
|
||||
- name: gluetun-data
|
||||
emptyDir: {}
|
||||
- name: config
|
||||
persistentVolumeClaim:
|
||||
claimName: media-config
|
||||
- name: downloads
|
||||
persistentVolumeClaim:
|
||||
claimName: media-downloads
|
||||
- name: init-script
|
||||
configMap:
|
||||
name: qbittorrent-init-script
|
||||
defaultMode: 0755
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: qbittorrent
|
||||
namespace: media
|
||||
labels:
|
||||
app: qbittorrent
|
||||
spec:
|
||||
type: NodePort
|
||||
selector:
|
||||
app: qbittorrent
|
||||
ports:
|
||||
- name: http
|
||||
port: 8080
|
||||
targetPort: 8080
|
||||
nodePort: 30080
|
||||
protocol: TCP
|
||||
# Note: Torrent ports are not exposed externally when using VPN
|
||||
# Peers will connect via VPN IP, not node IP
|
||||
Reference in New Issue
Block a user