Watch
0
0
Fork
You've already forked hyperhive
0

k8s: the queue's exporter is a ClusterIP service only the node reaches

The exporter's metrics port was a hostPort on the bridge's address, which Pod Security baseline and restricted forbid. It is a ClusterIP Service now, and the pod has a NetworkPolicy that admits the client port from any source and nothing else, so only the node reads the exporter, as the raw-table rules made it. The gateway's /metrics location dials the Service by name through nginx's resolver. The raw-table rules no longer name the exporter's port.
This commit is contained in:
atlas 2026-11-23 18:02:25 +01:00 • committed by maia
commit e29a8e71f3

View file

@ -1,4 +1,4 @@
# The iptables rules that give the queue pod's `hostPort`s the reach the
# The iptables rules that give the queue pod's client `hostPort` the reach the
# queue's container has. A `hostPort` is a DNAT rule, and what a DNAT rule
# rewrites is forwarded, never delivered to the host: the INPUT rules (the
# firewall's `allowedTCPPorts` and per-interface rules) never see it, and the
@ -9,8 +9,7 @@
# The client port is dropped for a packet addressed to the host unless it
# arrives on one of `trusted` (the host's loopback, the hive bridge and the
# pods' interfaces), or `openClient` is set, which is
# `deploy.nats.openFirewall`. The exporter's port answers with every client's
# name, so it is dropped for all but the host's own loopback.
# `deploy.nats.openFirewall`.
#
# Pure function — NOT a NixOS module. Returns the text for the firewall's
# `extraCommands`.
@ -18,7 +17,6 @@
{
chain,
clientPort,
metricsPort,
trusted,
openClient,
}:
@ -28,8 +26,6 @@ let
in
''
iptables -t raw -N ${chain} 2>/dev/null || iptables -t raw -F ${chain}
${rule} -p tcp --dport ${toString metricsPort} -i lo -j RETURN
${rule} -p tcp --dport ${toString metricsPort} ${local}
${lib.optionalString (!openClient) ''
${lib.concatMapStrings (i: ''
${rule} -p tcp --dport ${toString clientPort} -i ${i} -j RETURN