swarm-victoriametrics: own network namespace, gateway over a unix socket
The metrics store's container gets privateNetwork = true with no interface but loopback. VictoriaMetrics listens on unix:/run/swarm-victoriametrics/victoriametrics.sock, a host directory (root:nginx 0770) bind-mounted into the container, and every vhost location that forwarded to 127.0.0.1:8428 now forwards to that socket. The store runs as a static user whose primary group is nginx's gid, with UMask 0007, so the socket it creates is 0770 group nginx. This relies on VictoriaMetrics >= 1.153.0 honouring the umask (the locked nixpkgs ships 1.153.0). nixpkgs' readiness loop curls a TCP URL, so postStart is replaced with the same loop over --unix-socket. swarm.victoriametrics.port is removed (nothing binds it any more), with a mkRemovedOptionModule entry, and dropped from swarm-otel's host port-collision assertion. The container's resolver unit is dropped: there is no interface to reach the bridge resolver through, and the store resolves no names. The collector scrape, the collector push and Grafana's datasource already reach the store by its published domain, so they are unchanged. Refs #4815 Refs #3560
This commit is contained in:
parent
065933b83e
commit
5e653ab9b5
8 changed files with 139 additions and 59 deletions
|
|
@ -168,8 +168,10 @@ Grafana start — see [`secrets.md`](secrets.md).
|
|||
|
||||
**Where the data comes from.** The swarm's OTEL collector, below.
|
||||
|
||||
Neither container is reachable except through the gateway: both bind
|
||||
loopback, and VictoriaMetrics authenticates nothing itself. The
|
||||
Neither container is reachable except through the gateway: each listens
|
||||
on a unix socket only the gateway's nginx can open, and VictoriaMetrics
|
||||
runs in a network namespace of its own with no interface but loopback.
|
||||
VictoriaMetrics authenticates nothing itself. The
|
||||
`metrics.<swarm-domain>` vhost forwards only the store's read API (the
|
||||
Prometheus query, series, label and metadata routes, plus the vmui web UI)
|
||||
without a credential. It forwards the collector's OTLP push, and the
|
||||
|
|
@ -206,9 +208,8 @@ swarm.
|
|||
| `swarm.victorialogs.domain` | Only to rename it. |
|
||||
| `swarm.victorialogs.port` | Only if something else on the services host already claims `9428`. |
|
||||
|
||||
Like the metrics store, it binds loopback and takes no credential of its
|
||||
own: the gateway vhost is the only way in, and the collector is the only
|
||||
intended writer.
|
||||
It binds loopback and takes no credential of its own: the gateway vhost is
|
||||
the only way in, and the collector is the only intended writer.
|
||||
|
||||
The collector also scrapes this store's own metrics, at
|
||||
`https://<swarm.victorialogs.domain>/metrics`, so a collector on a host
|
||||
|
|
|
|||
Loading…
Reference in a new issue