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:
parent
9a72d07c05
commit
e29a8e71f3
1 changed files with 228 additions and 63 deletions
|
|
@ -228,10 +228,17 @@ holds the container back until the pod has gone.
|
|||
read before the DNAT: a packet for the node's address and the client port is
|
||||
dropped unless it arrives on the host's loopback, the hive bridge or a pod
|
||||
interface, or unless `deploy.nats.openFirewall` is on. The container's port
|
||||
has that reach. The exporter's port is a `hostPort` on the bridge's address,
|
||||
for the gateway's `/metrics` location on the host. The rules drop it on every
|
||||
interface but the host's loopback: the exporter answers with the name of
|
||||
every client, and only the host's own processes may read it.
|
||||
has that reach.
|
||||
- **The exporter's port.** The exporter's port has no `hostPort`: a ClusterIP
|
||||
Service, `swarm-nats-metrics`, fronts it, and the gateway's `/metrics`
|
||||
location on the host dials the Service's name through nginx's `resolver` (the
|
||||
hive's dnsmasq), as [the controller's](#the-controller) does, so
|
||||
`gateway.dns.enable` has to be on. The exporter answers with the name of every
|
||||
client, and only the node may read it. The pod's NetworkPolicy selects it for
|
||||
ingress and allows the client port from any source and nothing else. The
|
||||
cluster's policy engine always admits traffic from an address of the node, so
|
||||
the gateway and the kubelet's probes reach the pod, and a pod of the cluster,
|
||||
or a client of the bridge that the host forwards, doesn't reach the exporter.
|
||||
- **The leaf.** `tls-issue` logs in to the store with the pod's token as the
|
||||
role `swarm-nats` and issues the server's leaf from the same script as the
|
||||
host's `swarm-bao-nats-tls`. The key lands in a volume in memory. The
|
||||
|
|
@ -253,8 +260,8 @@ holds the container back until the pod has gone.
|
|||
`swarm-bao-nats-callout-xkey` deliver into the container, so the configuration
|
||||
turns them off. `swarm-bao-nats-tls` stays: it issues the host's own copy of
|
||||
the leaf for the gateway's `/metrics` vhost, and with no container it has
|
||||
nothing to restart. The gateway's location dials the exporter on the bridge's
|
||||
address where it dialled loopback.
|
||||
nothing to restart. The gateway's location dials the exporter's Service by
|
||||
name where it dialled loopback.
|
||||
- **State.** The server's store directory, `/var/lib/nats`, is the container's
|
||||
own on the host, `/var/lib/nixos-containers/swarm-nats/var/lib/nats`: the
|
||||
PersistentVolumeClaim `swarm-nats-store` binds a static local volume on it,
|
||||
|
|
@ -382,9 +389,9 @@ it dials the pod by name and verifies the name, and the responder in the pod
|
|||
admits it. A key written on the host before the switch is the pod's to read, a
|
||||
key the pod writes is the host server's after the switch back, and a stream
|
||||
written before a pod delete survives it: the replacement pod reads it from the
|
||||
same directory. The exporter answers the host's own processes through the
|
||||
published port, and the switch back removes the pod before the container
|
||||
starts.
|
||||
same directory. The exporter answers the host's own processes through its
|
||||
Service and no pod or bridge client, and the switch back removes the pod before
|
||||
the container starts.
|
||||
|
||||
The VM test `k8s-controller-switch` moves the controller. It asserts one copy at
|
||||
each step by the switch's own timestamps and by a sampler, that the pod is Ready
|
||||
|
|
|
|||
Loading…
Reference in a new issue