Jellyfin: NetworkPolicy (nur Ingress/Seerr/Node rein, nur DNS + öffentliches Internet raus)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,77 @@
|
|||||||
|
{{- /*
|
||||||
|
Network isolation for internet-facing apps (apps.<name>.networkPolicy). Jellyfin is reachable
|
||||||
|
from the internet (tv.smokyzone.de); if it were ever compromised it must not be able to reach
|
||||||
|
the rest of the cluster (Home Assistant, OpenBao, Gitea, the *arr APIs, ...) or the LAN.
|
||||||
|
|
||||||
|
Ingress: only the ingress controller, the listed in-namespace apps (e.g. Seerr) and the node
|
||||||
|
itself (kubelet probes, hostNetwork pods).
|
||||||
|
Egress: DNS + public internet only (metadata, artwork, plugins); all private ranges are denied,
|
||||||
|
which includes every cluster Service IP (10.152.183.0/24) and pod IP (10.1.0.0/16).
|
||||||
|
*/ -}}
|
||||||
|
{{- $root := . }}
|
||||||
|
{{- range $name, $app := .Values.apps }}
|
||||||
|
{{- if and $app.enabled $app.networkPolicy }}
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: {{ $name }}-isolation
|
||||||
|
namespace: {{ $root.Values.namespace }}
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: {{ $name }}
|
||||||
|
{{- include "media.labels" $root | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: {{ $name }}
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
|
- Egress
|
||||||
|
ingress:
|
||||||
|
- from:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: ingress-nginx
|
||||||
|
{{- range $app.networkPolicy.allowFrom }}
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range $root.Values.networkPolicy.nodeIPs }}
|
||||||
|
- ipBlock:
|
||||||
|
cidr: {{ . }}/32
|
||||||
|
{{- end }}
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: {{ $app.port }}
|
||||||
|
egress:
|
||||||
|
- to:
|
||||||
|
- namespaceSelector:
|
||||||
|
matchLabels:
|
||||||
|
kubernetes.io/metadata.name: kube-system
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
k8s-app: kube-dns
|
||||||
|
ports:
|
||||||
|
- protocol: UDP
|
||||||
|
port: 53
|
||||||
|
- protocol: TCP
|
||||||
|
port: 53
|
||||||
|
- to:
|
||||||
|
- ipBlock:
|
||||||
|
cidr: 0.0.0.0/0
|
||||||
|
except:
|
||||||
|
- 10.0.0.0/8
|
||||||
|
- 172.16.0.0/12
|
||||||
|
- 192.168.0.0/16
|
||||||
|
- 100.64.0.0/10
|
||||||
|
- 169.254.0.0/16
|
||||||
|
- 127.0.0.0/8
|
||||||
|
- ipBlock:
|
||||||
|
cidr: ::/0
|
||||||
|
except:
|
||||||
|
- fc00::/7
|
||||||
|
- fe80::/10
|
||||||
|
- ::1/128
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
+12
@@ -53,6 +53,13 @@ ingress:
|
|||||||
# StorageClass for the per-app config PVCs, empty = cluster default.
|
# StorageClass for the per-app config PVCs, empty = cluster default.
|
||||||
storageClassName: ""
|
storageClassName: ""
|
||||||
|
|
||||||
|
networkPolicy:
|
||||||
|
# loki's addresses: kubelet probes and hostNetwork pods (Home Assistant) come from here.
|
||||||
|
# 10.1.215.192 = vxlan.calico interface (host -> pod traffic may use it as source).
|
||||||
|
nodeIPs:
|
||||||
|
- 192.168.2.218
|
||||||
|
- 10.1.215.192
|
||||||
|
|
||||||
# Weekly active search for upgrades (German instead of English-only), see
|
# Weekly active search for upgrades (German instead of English-only), see
|
||||||
# templates/upgrade-search.yaml. Sunday 03:00 local time.
|
# templates/upgrade-search.yaml. Sunday 03:00 local time.
|
||||||
upgradeSearch:
|
upgradeSearch:
|
||||||
@@ -75,6 +82,11 @@ apps:
|
|||||||
gpu: true
|
gpu: true
|
||||||
# Remote access without VPN (templates/public-ingress.yaml): DE-only via GeoIP in
|
# Remote access without VPN (templates/public-ingress.yaml): DE-only via GeoIP in
|
||||||
# ingress-nginx, rate limited. jellyfin.smokyzone.de stays LAN/Tailscale-only.
|
# ingress-nginx, rate limited. jellyfin.smokyzone.de stays LAN/Tailscale-only.
|
||||||
|
# templates/networkpolicy.yaml: only ingress-nginx, Seerr and the node may connect;
|
||||||
|
# Jellyfin itself may only reach DNS and the public internet.
|
||||||
|
networkPolicy:
|
||||||
|
allowFrom:
|
||||||
|
- seerr
|
||||||
publicIngress:
|
publicIngress:
|
||||||
host: tv.smokyzone.de
|
host: tv.smokyzone.de
|
||||||
# Jellyfin's routing is case-insensitive, nginx paths are not -> both spellings.
|
# Jellyfin's routing is case-insensitive, nginx paths are not -> both spellings.
|
||||||
|
|||||||
Reference in New Issue
Block a user