docs: bare-IP rule for internal services + the Cilium route-merge and envoy-restart gotchas

Verification log for the Grafana bare-IP fix (10.10.0.2:8081), the 8081
exclusivity proof, the LAN/internet negatives, and the phone-peer state.
This commit is contained in:
Lance Walters 2026-10-27 00:40:37 -04:00
commit b4d2738750

View file

@ -5,7 +5,7 @@ updated: 2026-10-27
author: Lance Walters (written with Hermes devops agent)
tags: [homelab, kubernetes, wireguard, cilium, gateway-api, observability]
status: current
verified: 2026-10-27T04:40Z
verified: 2026-10-27T04:50Z
---
# Internal (WireGuard-only) services
@ -170,9 +170,21 @@ curl -sS -o /dev/null -w '%{http_code}\n' -H 'Host: forgejo.siriusdevops.com' ht
## 7. Gotchas
- **A `cluster.local`-style name will not resolve.** Either use an `/etc/hosts`
entry (what we do) or run these curls with `-H 'Host: …'` against the node
address. There is no internal DNS zone yet.
- **A `cluster.local`-style name will not resolve.** Use the bare-IP URL (no
DNS at all); an `/etc/hosts` entry plus `http://<name>.lab.internal:<port>/`
is a laptop-only convenience. There is no internal DNS zone yet.
- **Cilium merges hostname-less routes across listeners of the same Gateway.**
Giving the second bare-IP service its own *listener port* is not enough:
Cilium compiled both hostname-less `PathPrefix /` routes into one route
table, so `10.10.0.2:8081` and `:8082` each answered for **either** backend
(measured 9/11 split over 20 requests pre-fix). Each bare-IP service needs
its **own Gateway object** (`internal`/8081 → Grafana, `internal/hubble-ui`
on 8082 → Hubble), not just its own listener.
- **After adding/moving a listener, restart `cilium-envoy`** — the stale route
stayed programmed on the old port until
`kubectl -n kube-system delete pod -l k8s-app=cilium-envoy` (the pods were
6 days old). Verify per port with a repeated-request loop, not a single curl:
a 50/50 mix of two backends looks like a flaky service, not a config bug.
- **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.
@ -208,7 +220,8 @@ active scrape targets: 18 up / 0 down
$ 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
404 (SUPERSEDED 2026-10-27 04:35Z by §9 — the route now has no
hostnames, so this same request is a 302 to /login)
# 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
@ -233,3 +246,69 @@ allow_sign_up false; admin creds from Secret monitoring/grafana-admin
(admin-user / admin-password).
```
## 9. Verification log — 2026-10-27 (bare-IP fix: Grafana on `http://10.10.0.2:8081/`)
Commits `8939cbd` (Grafana: drop `hostnames` from the route) and, from the
concurrent Hubble card, `dcb708d` (Hubble moved to its own Gateway object —
required, see §7). Flux `monitoring` applied `master@sha1:dcb708d…`, which
contains `8939cbd`.
```
# the change
$ kubectl -n monitoring get httproute grafana -o yaml | sed -n '/^spec:/,/^status:/p'
spec:
parentRefs:
- {group: gateway.networking.k8s.io, kind: Gateway, name: internal, namespace: internal, sectionName: http-internal}
rules:
- backendRefs: [{group: "", kind: Service, name: kube-prometheus-stack-grafana, port: 80, weight: 1}]
matches: [{path: {type: PathPrefix, value: /}}]
# no `hostnames:` — any Host on the listener matches
$ kubectl -n flux-system get kustomizations | grep monitoring
monitoring True Applied revision: master@sha1:dcb708dff4cd3952436f4d5887e071dbde703945
# PHONE PATH — bare IP, no hosts entry, no Host header. From Legion (mesh):
$ curl -sS -D- -o /dev/null http://10.10.0.2:8081/
HTTP/1.1 302 Found
location: /login # relative — no absolute .internal redirect
server: envoy
$ curl -sSL -o /dev/null -w '%{http_code} final=%{url_effective} redirects=%{num_redirects}\n' \
http://10.10.0.2:8081/login
200 final=http://10.10.0.2:8081/login redirects=0
<title>Grafana # real login HTML, 0 redirects
# same request from rpi (source 10.10.0.1) and from a pod in the cluster:
$ ssh sirius@192.168.1.125 'curl -sS -o /dev/null -w "%{http_code}" http://10.10.0.2:8081/' -> 302
$ kubectl -n monitoring run gw-probe --rm -i --image=curlimages/curl:8.10.1 -- \
curl -sS -o /dev/null -w 'pod_bare=%{http_code}' http://10.10.0.2:8081/
pod_bare=302
# named URL still works
$ curl -sS -o /dev/null -w '%{http_code}' -H 'Host: grafana.lab.internal' http://10.10.0.2:8081/ -> 302
# port ownership — 8081 is Grafana's alone (15 consecutive requests, no hubble)
8081: grafana=15 hubble=0 other=0
$ kubectl -n internal get gateway internal -o jsonpath='{range .status.listeners[*]}{.name} attached={.attachedRoutes}{"\n"}{end}'
http-internal attached=1
# negative 1 — LAN (echoed from Legion, 192.168.1.126 on the LAN, while on WG too)
$ curl -m 4 http://192.168.1.179:8081/ -> curl: (28) timed out, http_code 000
$ curl -m 4 http://192.168.1.125:8081/ -> curl: (28) timed out, http_code 000
# negative 2 — internet (cloudflared ingress on rpi: still 8 hostnames + 404 catch-all)
siriusdevops.com, www., forgejo., paaas., piedmonthomesvc.com, www.,
siriusgrowthsolutions.com, www., -> http_status:404
-> no grafana/lab.internal entry
$ curl -H 'Host: grafana.lab.internal' http://10.10.0.2:8080/ -> 404 (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
# phone peer at the time of the fix (Pi hub): still offline, reconnect required
$ sudo wg show wg0 latest-handshakes
A1NSWT7K9Dz…("Peer SiriusMobile", 10.10.0.4) age=570919s (~6.6 days)
```
**The URL to use on the phone: `http://10.10.0.2:8081/`** — tunnel connected,
client `AllowedIPs` covering `10.10.0.0/24`.