apps(metabase): deploy Metabase (WireGuard-only :8085) with CNPG app DB

- apps/base/metabase: namespace, CNPG Cluster pg (5Gi local-path, siriussec),
  Metabase Deployment v0.65.6.3 (1.5G heap, no PVC), Service, hostname-less
  HTTPRoute on the dedicated metabase Gateway
- infrastructure/networking/internal: new Gateway metabase on port 8085
  (own RouteConfiguration, so it cannot merge with Grafana's bare route)
- host firewall: 8085 in siriussec nft set + rpi ufw guard
This commit is contained in:
Lance Walters 2026-11-22 00:32:31 -05:00
commit 930752152e
13 changed files with 225 additions and 14 deletions

View file

@ -0,0 +1,31 @@
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: metabase
namespace: internal
labels:
dedicated: network
annotations:
# Why a second Gateway instead of a second listener on `internal`:
# Cilium renders one RouteConfiguration per Gateway shared by all its
# listeners, so a hostname-less route on any listener of `internal` would
# merge with Grafana's into one 50/50 weighted route. Its own Gateway gives
# it its own RouteConfiguration.
sirius.dev/purpose: bare-IP listener for Metabase (WireGuard only)
spec:
gatewayClassName: cilium
listeners:
- name: http-internal
protocol: HTTP
# PORT MUST BE FREE ON *EVERY* NODE THAT RUNS cilium-envoy (siriussec
# 10.10.0.2 is the only `gateway=true` node today). Cilium binds
# 0.0.0.0:<port> hostNetwork, so a port held by anything else on a gateway
# node makes xDS reject the listener there ("cannot bind '0.0.0.0:<port>':
# Address already in use") and restart-loops that node's Envoy — which
# fronts the public ingress. Verified free 2026-11-22:
# `ss -lntH "sport = :8085" | wc -l` = 0 on siriussec.
# 8080 (public), 8081 (Grafana), 8084 (Hubble UI) are taken.
port: 8085
allowedRoutes:
namespaces:
from: All

View file

@ -21,7 +21,8 @@ exactly one node.
| siriussec (10.10.0.2) — **load bearing** | nftables table `inet internal_gw`, loaded by a oneshot unit (same pattern as `k8s-api-firewall.service`) | `siriussec-internal-gw.nft`, `internal-gw-firewall.service` |
| rpi (10.10.0.1) — **inert guard** | ufw rules inserted above the `allow from 192.168.1.0/24` catch-all | `rpi-ufw-internal-gw.sh` |
Effective policy for `:8081` (Grafana) and `:8084` (Hubble UI):
Effective policy for `:8081` (Grafana), `:8084` (Hubble UI) and `:8085`
(Metabase):
**accept from 10.10.0.0/24 and 10.244.0.0/16, accept on lo, drop everything
else** (LAN, tailscale, public). Envoy binds every listener on `0.0.0.0`, so a
new internal listener port is a LAN exposure until it is added here. The
@ -56,7 +57,7 @@ Verify:
# the drop counter non-zero after a LAN request
nft list table inet internal_gw
# rpi
ufw status | grep -E '8081|8084'
ufw status | grep -E '8081|8084|8085'
```
Negative test from the LAN must be a timeout (DROP), never 200:
@ -70,4 +71,4 @@ When a new internal listener port is added, add it to the `tcp dport { … }` se
in `siriussec-internal-gw.nft` and to `PORTS` in `rpi-ufw-internal-gw.sh` (which
inserts one deny for the port plus mesh and pod-CIDR allows above the LAN
catch-all), then reinstall both and re-run the two negative tests above with the
new port.
new port.

View file

@ -4,7 +4,7 @@
# Flux-managed); the file lives in git at
# infrastructure/networking/internal/host-firewall/.
[Unit]
Description=Restrict the internal Gateway listeners (8081, 8082) to WireGuard
Description=Restrict the internal Gateway listeners (8081, 8084, 8085) to WireGuard
After=network-online.target
Wants=network-online.target
@ -14,4 +14,4 @@ ExecStart=/usr/sbin/nft -f /etc/nftables.d/internal-gw.nft
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target

View file

@ -6,14 +6,15 @@
# Final order per port: allow 10.10.0.0/24, allow 10.244.0.0/16, deny the rest.
#
# Ports: 8081 = Grafana (`internal` Gateway listener http-internal),
# 8084 = Hubble UI (`internal` Gateway listener hubble-ui).
# 8084 = Hubble UI (`internal` Gateway listener hubble-ui),
# 8085 = Metabase (`metabase` Gateway listener http-internal).
# Add a new internal listener port to PORTS; the loop is idempotent, so
# re-running after a port is already firewalled only adds what is missing.
#
# Run as root on rpi (192.168.1.125).
set -euo pipefail
PORTS="${PORTS:-8081 8084}"
PORTS="${PORTS:-8081 8084 8085}"
for port in $PORTS; do
if ufw status | grep -q "${port}/tcp"; then
@ -28,4 +29,4 @@ for port in $PORTS; do
echo "$port rules installed:"
ufw status | grep "${port}/tcp" || true
done
done

View file

@ -1,6 +1,6 @@
#!/usr/sbin/nft -f
# Internal (WireGuard-only) gateway listeners: TCP 8081 (Grafana) and 8084
# (Hubble UI).
# Internal (WireGuard-only) gateway listeners: TCP 8081 (Grafana), 8084
# (Hubble UI) and 8085 (Metabase).
#
# Cilium's hostNetwork Envoy binds every Gateway listener on 0.0.0.0, so the
# internal listeners are open on the LAN interface the moment the Gateway is
@ -22,13 +22,13 @@ table inet internal_gw {
type filter hook input priority filter; policy accept;
# local process / kubelet probes
tcp dport { 8081, 8084 } iifname "lo" counter accept
tcp dport { 8081, 8084, 8085 } iifname "lo" counter accept
# WireGuard mesh (Legion = 10.10.0.3, nodes, remote hub spokes)
# and the pod network (in-cluster scrapers, probes)
tcp dport { 8081, 8084 } ip saddr { 10.10.0.0/24, 10.244.0.0/16 } counter accept
tcp dport { 8081, 8084, 8085 } ip saddr { 10.10.0.0/24, 10.244.0.0/16 } counter accept
# everything else: LAN, tailscale, public
tcp dport { 8081, 8084 } counter drop
tcp dport { 8081, 8084, 8085 } counter drop
}
}
}

View file

@ -4,3 +4,4 @@ resources:
- namespace.yaml
- gateway.yaml
- gateway-hubble-ui.yaml
- gateway-metabase.yaml