Also flag clusters/home as not-reconciled: the bootstrapped flux-system Kustomization reads ./clusters/homek8s, which is why the monitoring entry there had never been created.
9.7 KiB
| title | created | updated | author | tags | status | verified | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Internal (WireGuard-only) services on the home cluster | 2026-10-27 | 2026-10-27 | Lance Walters (written with Hermes devops agent) |
|
current | 2026-10-27T04:40Z |
Internal (WireGuard-only) services
How a service in this cluster is exposed to the WireGuard mesh and nothing
else — not to the LAN, not to the internet — and how to add the next one.
First user: Grafana (monitoring). Second: Hubble UI (kube-system).
Related: Home-Lab-Kubernetes-Cluster, docs/cluster-overview.md,
infrastructure/networking/internal/.
1. Why this is not just "an HTTPRoute without a hostname"
Cilium's Gateway implementation runs one hostNetwork Envoy per gateway node
(cilium-envoy DaemonSet, node selector node-role.kubernetes.io/gateway=true
— currently rpi 10.10.0.1 and siriussec 10.10.0.2) and binds every
listener port on 0.0.0.0. There is no Gateway API field for "listen on wg0
only". Consequences:
- A listener on port 8081 is reachable on
192.168.1.125:8081,192.168.1.179:8081and the public interface the moment it is Programmed. - The Gateway object cannot enforce the network boundary. The host firewall is the enforcement point. That is the whole trick.
- Routing on the internal listener is hostname-based, so the service is reached
as
http://<name>.lab.internal:8081with an/etc/hostsentry on the client.
Public traffic has no path here: the only public ingress is the cloudflared
tunnel, whose ingress list is an explicit allow-list of hostnames pointing at
http://10.10.0.2:8080 (the public gateway). Nothing points at 8081, and
*.lab.internal resolves nowhere publicly.
2. The pieces
| Object / unit | Where | Purpose |
|---|---|---|
Gateway internal/internal |
infrastructure/networking/internal/gateway.yaml (Flux: infrastructure) |
listener http-internal, port 8081, allowedRoutes: All so any namespace can attach |
HTTPRoute <svc> |
the app's own tree (e.g. monitoring/controllers/home/httproute.yaml) |
parentRefs: internal/internal#http-internal, hostnames: [<name>.lab.internal] |
table inet internal_gw + internal-gw-firewall.service |
siriussec host (/etc/nftables.d/internal-gw.nft) |
drop :8081 from everything but 10.10.0.0/24, 10.244.0.0/16, lo |
| ufw rules (inserted above the LAN catch-all) | rpi host | same policy for :8081 |
infrastructure/networking/internal/host-firewall/ |
repo | the two host artifacts + install/verify instructions |
Both firewalls must be in place: Envoy listens on both gateway nodes, so leaving either node's 8081 open leaks the service to the LAN from that node's address (and the other node answers 503, which still proves a listener exists).
3. Current internal services
| Service | URL (over WireGuard) | Client /etc/hosts line |
Route |
|---|---|---|---|
| Grafana | http://grafana.lab.internal:8081/ |
10.10.0.2 grafana.lab.internal |
monitoring/grafana |
Always use siriussec's address (10.10.0.2) in the hosts file, not the
Pi's: Envoy on a node that does not run the backend pods completes the TCP
handshake and then hangs (SYN-ACK back, no ACK — see the co-location pitfall in
the home-k8s skill). The backends are pinned to siriussec, so 10.10.0.2 is
the only origin that works.
4. Add the next internal service
-
Confirm the port is firewalled.
:8081is closed to the LAN already; a new listener port needs its own rules (see §5). Reuse 8081 unless two services must be distinguished by port. -
Deploy the workload in its own namespace, pinned with
nodeSelector: {kubernetes.io/hostname: siriussec}(amd64 + local-path; the Pi is arm64 and its listener only serves pods scheduled on the Pi). -
Add the route next to the workload:
apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: name: <svc> namespace: <ns> spec: parentRefs: - name: internal namespace: internal sectionName: http-internal hostnames: - <name>.lab.internal rules: - matches: - path: {type: PathPrefix, value: /} backendRefs: - name: <service> port: <port>A
ReferenceGrantis only needed for cross-namespace backends; the route itself is allowed byallowedRoutes: Allon the listener. -
Commit, push, reconcile (repo →
gitrepository, then the app'skustomization), then prove it from the mesh:curl -sS -o /dev/null -w '%{http_code}\n' \ -H 'Host: <name>.lab.internal' http://10.10.0.2:8081/ -
Add the row to the table in §3.
5. Firewall changes for a new port
siriussec — add the same three lines with the new port to
/etc/nftables.d/internal-gw.nft and systemctl reload-or-restart internal-gw-firewall.service (it is a oneshot nft -f, so re-running is safe):
tcp dport <port> iifname "lo" accept
tcp dport <port> ip saddr { 10.10.0.0/24, 10.244.0.0/16 } accept
tcp dport <port> counter drop
rpi — the ufw equivalents, inserted above the allow from 192.168.1.0/24
catch-all (ufw insert, never plain ufw allow, or the LAN allow matches
first):
ufw insert 1 deny to any port <port> proto tcp comment 'internal gateway: wg only'
ufw insert 1 allow from 10.10.0.0/24 to any port <port> proto tcp comment 'internal gateway (wg mesh)'
ufw insert 2 allow from 10.244.0.0/16 to any port <port> proto tcp comment 'internal gateway (pods)'
6. Negative tests (run these after every change)
# 1. From a LAN host (Legion on 192.168.1.0/24, or rpi toward siriussec):
# DROP = timeout, not connection-refused and never 200.
curl -m 3 -sS -o /dev/null -w '%{http_code}\n' http://192.168.1.179:8081/ # -> 000 (timed out)
curl -m 3 -sS -o /dev/null -w '%{http_code}\n' http://192.168.1.125:8081/ # -> 000 (timed out)
# 2. From a mesh host, the listener must still work:
curl -sS -o /dev/null -w '%{http_code}\n' -H 'Host: grafana.lab.internal' http://10.10.0.2:8081/ # -> 302 (login)
# 3. Not in the public tunnel's ingress list (run on rpi):
curl -s http://127.0.0.1:20241/config | python3 -c \
"import json,sys; d=json.load(sys.stdin)['config']; print([i.get('hostname') for i in d['ingress']])"
# 4. The public gateway is untouched:
curl -sS -o /dev/null -w '%{http_code}\n' -H 'Host: forgejo.siriusdevops.com' http://10.10.0.2:8080/
7. Gotchas
- A
cluster.local-style name will not resolve. Either use an/etc/hostsentry (what we do) or run these curls with-H 'Host: …'against the node address. There is no internal DNS zone yet. - Do not add these hostnames to the cloudflared tunnel "to make them easier to reach". That is a public exposure of a service that has no authentication story beyond Grafana's own. The tunnel ingress list is the public allow-list.
sudo nft -fis not persistent by itself — it must go throughinternal-gw-firewall.service(enabled at boot), same ask8s-api-firewall.service.- Changing the
internalGateway'sallowedRoutesdoes not need an Envoy restart; Cilium reconciles the route table. Changing the listener (port, protocol) does need thecilium-envoypods restarted (kubectl -n kube-system delete pod -l k8s-app=cilium-envoy). - Envoy on both nodes answers for the listener. If a request to
10.10.0.1:8081hangs for ~5 s and returns 503 while10.10.0.2:8081is instant, that is the co-location fault (backend not on that node), not a firewall or routing problem.
8. Verification log — 2026-10-27 (Grafana)
Commit d3741df on master, reconciled by Flux (gitrepository first, then
kustomization flux-system, which created kustomization monitoring).
# flux
NAME READY STATUS
monitoring True Applied revision: master@sha1:d3741df...
# helm + workloads
kube-prometheus-stack True Helm install succeeded for release monitoring/kube-prometheus-stack.v1 with chart [email protected]
prometheus-kube-prometheus-stack-prometheus-db-... Bound 10Gi RWO local-path
pods: grafana 3/3, kube-state-metrics 1/1, operator 1/1, node-exporter 1/1, prometheus 2/2 (all on siriussec)
Prometheus CR: retention 7d / retentionSize 8GB, replicas 1, remoteWrite none, PVC 10Gi local-path
active scrape targets: 18 up / 0 down
# positive — from Legion over WireGuard
$ curl -sS -o /dev/null -w '%{http_code}' -L http://grafana.lab.internal:8081/
200 (POST /login with the secret creds -> 200 "Logged in"; /api/user -> admin)
$ curl -sS -o /dev/null -w '%{http_code}' http://10.10.0.2:8081/ # no Host match
404
# negative 1 — LAN (from Legion, 192.168.1.0/24)
$ curl -m 3 http://192.168.1.179:8081/ -> timed out (curl 28), http_code 000
$ curl -m 3 http://192.168.1.125:8081/ -> timed out (curl 28), http_code 000
(nft table inet internal_gw counts the drops on siriussec; ufw rules at
positions 1-3 on rpi sit above `allow from 192.168.1.0/24`)
# negative 2 — internet
cloudflared ingress (9 entries): siriusdevops.com, www., forgejo., paaas.,
piedmonthomesvc.com, www., siriusgrowthsolutions.com, www., 404-catch-all
-> no grafana/lab.internal entry; and `curl -H 'Host: grafana.lab.internal'
http://10.10.0.2:8080/` returns 404 (the public gateway has no such route).
# regression — public ingress intact (from rpi)
$ curl -H 'Host: forgejo.siriusdevops.com' http://10.10.0.2:8080/ -> 200
# grafana provisioning
24 dashboards in Grafana (includes Node Exporter / Nodes, Kubernetes /
Compute Resources / Pod, ... / Cluster, ... / Namespace); datasource
`kube-prometheus-stack-grafana-datasource` -> Prometheus; anonymous disabled,
allow_sign_up false; admin creds from Secret monitoring/grafana-admin
(admin-user / admin-password).