homek8s/monitoring/controllers/home/httproute.yaml
Lance Walters 8939cbdd78 grafana: serve it on the bare WireGuard IP (drop HTTPRoute hostnames)
A phone cannot edit /etc/hosts, so it sends Host: 10.10.0.2:8081, matches no
.lab.internal route and gets a 404 from Envoy. With no hostnames on the route
any Host on the internal listener matches, so http://10.10.0.2:8081/ serves
Grafana and the named URL keeps working. Port 8081 stays Grafana-only; docs now
state the bare-IP rule and the phone-path tests.
2026-10-27 00:35:53 -04:00

35 lines
1.4 KiB
YAML

# Grafana is served by the INTERNAL gateway only (gateway-system is the public
# one, fed by the Cloudflare tunnel). There is no Cloudflare ingress entry for
# this hostname and there must never be one.
#
# Reachable over WireGuard, and deliberately WITHOUT a Host header mapping:
# phones: http://10.10.0.2:8081/
# laptops: http://grafana.lab.internal:8081/ (10.10.0.2 grafana.lab.internal)
#
# `hostnames` is intentionally ABSENT: a phone sends `Host: 10.10.0.2:8081`,
# which matches no `.lab.internal` hostname, and Envoy answers 404. A route
# with no hostnames matches any Host on the listener, so both URLs work.
# Port 8081 is Grafana's alone — do not attach a second hostname-less route to
# `http-internal`: two bare routes on one listener make precedence ambiguous,
# so any future internal service gets its own listener port.
#
# The listener answers only on 10.10.0.0/24 + the pod CIDR — the host firewall
# (see docs/internal-wireguard-services.md) drops :8081 everywhere else.
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: grafana
namespace: monitoring
spec:
parentRefs:
- name: internal
namespace: internal
sectionName: http-internal
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: kube-prometheus-stack-grafana
port: 80