diff --git a/infrastructure/networking/cilium/hubble-ui-httproute.yaml b/infrastructure/networking/cilium/hubble-ui-httproute.yaml index 01f1053..477154f 100644 --- a/infrastructure/networking/cilium/hubble-ui-httproute.yaml +++ b/infrastructure/networking/cilium/hubble-ui-httproute.yaml @@ -8,14 +8,15 @@ metadata: app.kubernetes.io/part-of: cilium spec: parentRefs: - # Dedicated listener on port 8082 — deliberately NOT the shared 8081 - # listener. There is no `hostnames` field here on purpose: the route must + # Dedicated Gateway on port 8082 — deliberately NOT the shared `internal` + # gateway. There is no `hostnames` field here on purpose: the route must # match a request whose Host header is the bare IP (10.10.0.2:8082), which - # is the only form a phone can use. A hostname-less route has to own its - # listener, hence the separate port. - - name: internal + # is the only form a phone can use. Cilium merges hostname-less routes that + # share a Gateway into one 50/50 weighted route, so a bare-IP service needs + # its own Gateway as well as its own port. + - name: hubble-ui namespace: internal - sectionName: hubble-ui + sectionName: http-internal rules: - matches: - path: diff --git a/infrastructure/networking/internal/gateway-hubble-ui.yaml b/infrastructure/networking/internal/gateway-hubble-ui.yaml new file mode 100644 index 0000000..ff3b8b1 --- /dev/null +++ b/infrastructure/networking/internal/gateway-hubble-ui.yaml @@ -0,0 +1,23 @@ +apiVersion: gateway.networking.k8s.io/v1 +kind: Gateway +metadata: + name: hubble-ui + 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 the Hubble UI (WireGuard only) +spec: + gatewayClassName: cilium + listeners: + - name: http-internal + protocol: HTTP + port: 8082 + allowedRoutes: + namespaces: + from: All diff --git a/infrastructure/networking/internal/gateway.yaml b/infrastructure/networking/internal/gateway.yaml index 3e8bd22..ed29456 100644 --- a/infrastructure/networking/internal/gateway.yaml +++ b/infrastructure/networking/internal/gateway.yaml @@ -13,22 +13,19 @@ spec: port: 8081 # Any namespace may attach a route: the security boundary for this listener # is the HOST firewall (only 10.10.0.0/24 + pod CIDR may reach :8081), not - # the namespace. Keeps the pattern reusable for the next internal service - # (Hubble lives in kube-system) without editing this Gateway again. + # the namespace. allowedRoutes: namespaces: from: All - # One listener per service that must be reachable by BARE IP. + # NOTE (2026-10-27): do NOT add another hostname-less route here, and do not + # add a second listener for one. Cilium 1.20 renders ONE RouteConfiguration + # per Gateway (`listener-insecure`) shared by all of that Gateway's + # listeners, so two routes that both match `Prefix: /` with no hostnames are + # merged into a single route with `weightedClusters` weight 1/1 — every + # request then lands on a random backend, on every port of the gateway. + # Proven live: http://10.10.0.2:8081/ and :8082/ each served Grafana ~58% and + # Hubble UI ~42% of the time once Hubble's bare route existed here. # - # A hostname-scoped route (`hostnames: [x.lab.internal]`) does not match a - # request whose Host is the IP, so `curl http://10.10.0.2:8081/` returns 404 - # and a phone (no /etc/hosts) cannot use the service at all. The fix is a - # listener whose route has no `hostnames` — but a hostname-less PathPrefix / - # route swallows every request on its listener, so it cannot share a port - # with a hostname-routed one. Hence: new service => new port. - - name: hubble-ui - protocol: HTTP - port: 8082 - allowedRoutes: - namespaces: - from: All + # A service that must answer on its bare IP therefore gets its OWN Gateway + # object, which gets its own Envoy RouteConfiguration — see + # `gateway-hubble-ui.yaml` (port 8082). One bare-IP service per Gateway. diff --git a/infrastructure/networking/internal/kustomization.yaml b/infrastructure/networking/internal/kustomization.yaml index a64a0c8..60f44f2 100644 --- a/infrastructure/networking/internal/kustomization.yaml +++ b/infrastructure/networking/internal/kustomization.yaml @@ -3,3 +3,4 @@ kind: Kustomization resources: - namespace.yaml - gateway.yaml + - gateway-hubble-ui.yaml