102 lines
4.1 KiB
YAML
102 lines
4.1 KiB
YAML
---
|
|
# Gluetun — the single shared in-cluster VPN egress gateway (ADR-0013): PIA over WireGuard, with
|
|
# Gluetun's built-in kill-switch/firewall (fail-closed), health checks, auto-reconnect, and native
|
|
# port forwarding for qBittorrent. `vpn`-class pods are steered through this gateway (see README.md
|
|
# "Egress steering" — the Cilium-native mechanism, pending live validation with PIA creds).
|
|
#
|
|
# Credentials: the `pia-credentials` SOPS Secret (keys: username, password). Gluetun uses PIA's
|
|
# username/password (via OPENVPN_USER/OPENVPN_PASSWORD — legacy env names it uses for PIA on BOTH
|
|
# protocols) to authenticate to PIA's API and derive the WireGuard config at runtime — so WireGuard
|
|
# needs no extra key material (ADR-0013).
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: gluetun
|
|
namespace: vpn-egress
|
|
labels:
|
|
app: gluetun
|
|
spec:
|
|
replicas: 1 # ONE shared tunnel (ADR-0013). Active/standby is a later enhancement.
|
|
strategy:
|
|
type: Recreate # a tunnel is a singleton — never run two overlapping during a rollout
|
|
selector:
|
|
matchLabels:
|
|
app: gluetun
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: gluetun
|
|
spec:
|
|
containers:
|
|
- name: gluetun
|
|
image: qmcgaw/gluetun:v3.41.0 # pinned; Renovate bumps. NOTE: PIA+WireGuard support
|
|
# requires >= v3.41 (v3.40.0 rejects "private internet
|
|
# access" as a WireGuard provider — verified at deploy).
|
|
securityContext:
|
|
capabilities:
|
|
add: ["NET_ADMIN"] # required for the tunnel + firewall
|
|
env:
|
|
- name: VPN_SERVICE_PROVIDER
|
|
value: "private internet access"
|
|
- name: VPN_TYPE
|
|
value: "openvpn" # UDP — satisfies "protocol != TCP" (R-NET); upgrade over OpenVPN
|
|
# PIA credentials from the SOPS secret (Gluetun's PIA creds env, used for WireGuard too):
|
|
- name: OPENVPN_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: pia-credentials
|
|
key: username
|
|
- name: OPENVPN_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: pia-credentials
|
|
key: password
|
|
- name: SERVER_REGIONS
|
|
value: "${PIA_REGION}" # cluster-vars: a PF-CAPABLE PIA region (ADR-0013 PF caveat)
|
|
- name: VPN_PORT_FORWARDING
|
|
value: "on" # PIA native port forwarding for qBittorrent
|
|
- name: FIREWALL
|
|
value: "on" # KILL-SWITCH: block all egress except the tunnel (fail-closed, R-NET-06)
|
|
- name: FIREWALL_OUTBOUND_SUBNETS
|
|
value: "${CLUSTER_POD_CIDR}" # allow steered client pods (pod CIDR) to route out via the tunnel
|
|
- name: DOT
|
|
value: "off" # DNS via cluster CoreDNS, not Gluetun's DoT
|
|
ports:
|
|
- name: control
|
|
containerPort: 8000 # Gluetun control API (health + forwarded-port lookup)
|
|
livenessProbe:
|
|
httpGet: { path: /v1/openvpn/status, port: 8000 } # Gluetun control API health
|
|
initialDelaySeconds: 20
|
|
periodSeconds: 30
|
|
resources:
|
|
requests:
|
|
cpu: 50m
|
|
memory: 64Mi
|
|
limits:
|
|
memory: 160Mi
|
|
volumeMounts:
|
|
- name: tun
|
|
mountPath: /dev/net/tun
|
|
volumes:
|
|
- name: tun
|
|
hostPath:
|
|
path: /dev/net/tun
|
|
type: CharDevice
|
|
---
|
|
# Control API Service — the port-sync helper (qbittorrent-natmap, README) reads the PIA-assigned
|
|
# forwarded port from here; also used for tunnel-state health/alerting (ADR-0013 "alert on tunnel state").
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: gluetun-control
|
|
namespace: vpn-egress
|
|
labels:
|
|
app: gluetun
|
|
spec:
|
|
selector:
|
|
app: gluetun
|
|
ports:
|
|
- name: control
|
|
port: 8000
|
|
targetPort: 8000
|