# immich faces the internet (every member of the group logs in, and shared # links are public), so its pods only reach each other, DNS and the # internet: not the LAN (NAS, router), the Kubernetes API or other # namespaces. The OIDC login with authentik goes out through its public # address. Ingress comes from Envoy, the CNPG operator and the node itself # (kubelet probes; 10.1.7.64 is the node's Calico VXLAN address, # projectcalico.org/IPv4VXLANTunnelAddr). apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: default spec: podSelector: {} policyTypes: - Ingress - Egress ingress: - from: - podSelector: {} - from: - ipBlock: cidr: 192.168.1.204/32 - ipBlock: cidr: 10.1.7.64/32 egress: - to: - podSelector: {} - to: - namespaceSelector: matchLabels: kubernetes.io/metadata.name: kube-system podSelector: matchLabels: k8s-app: kube-dns ports: - protocol: UDP port: 53 - protocol: TCP port: 53 # The internet: authentik's public address, the ML models from Hugging # Face. - to: - ipBlock: cidr: 0.0.0.0/0 except: - 10.0.0.0/8 - 100.64.0.0/10 - 169.254.0.0/16 - 172.16.0.0/12 - 192.168.0.0/16 --- apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: server-from-envoy spec: podSelector: matchLabels: app.kubernetes.io/instance: helm-immich app.kubernetes.io/name: server policyTypes: - Ingress ingress: - from: - namespaceSelector: matchLabels: kubernetes.io/metadata.name: envoy-gateway-system podSelector: matchLabels: app.kubernetes.io/name: envoy ports: - port: 2283 --- # The CNPG operator checks each instance on its status port and connects to # PostgreSQL; the instance manager inside each pod watches its Cluster # through the API server (the node, port 16443). The barman cloud sidecar # sends the WAL and the base backups to Garage on the NAS # (postgresql-backup.yaml). apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: postgres-cnpg spec: podSelector: matchExpressions: - key: cnpg.io/cluster operator: Exists policyTypes: - Ingress - Egress ingress: - from: - namespaceSelector: matchLabels: kubernetes.io/metadata.name: cnpg-system ports: - port: 8000 - port: 5432 egress: - to: - ipBlock: cidr: 192.168.1.204/32 ports: - port: 16443 - to: - ipBlock: cidr: 192.168.1.99/32 ports: - port: 3900 --- # cert-manager's HTTP-01 solver, which runs only while a certificate # renews: Let's Encrypt and cert-manager's own self check reach it on 8089 # through Envoy. The policies above let Envoy reach the app's port only, # which left the solver unreachable (found 2026-10-26, when ynab's renewal # hung). apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: acme-http01-solver spec: podSelector: matchLabels: acme.cert-manager.io/http01-solver: "true" policyTypes: - Ingress ingress: - from: - namespaceSelector: matchLabels: kubernetes.io/metadata.name: envoy-gateway-system podSelector: matchLabels: app.kubernetes.io/name: envoy ports: - port: 8089