apps(netsec): hubble-flow-collector DaemonSet — filtered flow capture on siriussec #39

Merged
sirius merged 1 commit from feat/netsec-hubble-flow-collector into master 2026-11-27 05:03:12 +00:00
Owner

Phase 1a of the netsec program: a long-lived Hubble flow consumer on siriussec.

Why a DaemonSet, not a cron: the Cilium agent ring buffer holds ~4096 events per type — at the measured ~148 flows/s that is ~28 s of history, so hubble observe --last N on a 5-minute timer loses almost everything.

What it writes (apps/base/netsec/):

  • Server-side filter: --type drop --type policy-verdict --type l7 --type trace:to-network. The 148/s trace bulk (all other subtypes) never leaves the agent.
  • Post-filter in filter.awk: drop / policy-verdict / l7 are always kept; trace:to-network is kept only when a peer is outside 10.244.0.0/16 and 10.10.0.0/24 (the to-world beacon/exfil signal). Intra-cluster trace ACK chatter is discarded.
  • Rotation is in the writer (collect.sh): <= 6 files x 150 MiB = 900 MiB, inside the 1 GiB cap, oldest deleted first, plus an independent total-bytes bound. Nothing else on the node is written; logs go to stdout.

Blast radius: one namespace, one DaemonSet pinned to siriussec, one root-owned directory /var/log/netsec. The socket is mounted as a single file (/var/run/cilium/hubble.sock, type Socket, read-only) — mounting /var/run/cilium would hand the pod cilium.sock, i.e. cluster datapath admin. Image is the agent's own digest (v1.20.1@sha256:ae9ea21f…) so there is no protobuf/version skew. runAsUser: 0 is required to open the root-owned 0660 socket; no capabilities, no API token, not privileged.

No Service, no HTTPRoute, no Gateway port, no PVC, no change to cilium-config or ds/cilium.

Verification (post-merge, on the live node): rollout status, ls /var/run/cilium/ shows only hubble.sock, tail/du -sb of /var/log/netsec, per-class line counts, ds/cilium still 3/3.

Phase 1a of the netsec program: a long-lived Hubble flow consumer on siriussec. **Why a DaemonSet, not a cron**: the Cilium agent ring buffer holds ~4096 events per type — at the measured ~148 flows/s that is ~28 s of history, so `hubble observe --last N` on a 5-minute timer loses almost everything. **What it writes** (`apps/base/netsec/`): - Server-side filter: `--type drop --type policy-verdict --type l7 --type trace:to-network`. The 148/s `trace` bulk (all other subtypes) never leaves the agent. - Post-filter in `filter.awk`: drop / policy-verdict / l7 are always kept; `trace:to-network` is kept only when a peer is outside `10.244.0.0/16` and `10.10.0.0/24` (the to-world beacon/exfil signal). Intra-cluster trace ACK chatter is discarded. - Rotation is in the writer (`collect.sh`): <= 6 files x 150 MiB = 900 MiB, inside the 1 GiB cap, oldest deleted first, plus an independent total-bytes bound. Nothing else on the node is written; logs go to stdout. **Blast radius**: one namespace, one DaemonSet pinned to `siriussec`, one root-owned directory `/var/log/netsec`. The socket is mounted as a **single file** (`/var/run/cilium/hubble.sock`, type Socket, read-only) — mounting `/var/run/cilium` would hand the pod `cilium.sock`, i.e. cluster datapath admin. Image is the agent's own digest (`v1.20.1@sha256:ae9ea21f…`) so there is no protobuf/version skew. `runAsUser: 0` is required to open the root-owned 0660 socket; no capabilities, no API token, not privileged. No Service, no HTTPRoute, no Gateway port, no PVC, no change to `cilium-config` or `ds/cilium`. Verification (post-merge, on the live node): rollout status, `ls /var/run/cilium/` shows only `hubble.sock`, `tail`/`du -sb` of `/var/log/netsec`, per-class line counts, `ds/cilium` still 3/3.
Phase 1a of the netsec program. A long-lived hubble observe consumer (the agent
ring buffer is ~28s at 148 flows/s, so polling is lossy), server-side filtered
to drop/policy-verdict/l7/trace:to-network, post-filtered so only drop, denial,
L7 and to-world peers (outside 10.244.0.0/16 + 10.10.0.0/24) reach disk.

Bounded at <=6 files x 150 MiB = 900 MiB under the 1 GiB cap, oldest deleted
first, enforced by the writer itself. The socket is mounted as a single file
(/var/run/cilium/hubble.sock); the directory would hand over cilium.sock, i.e.
cluster datapath admin. Image is the agent's own digest, no version skew.

No Service, no HTTPRoute, no Gateway port: node-local writer, root-owned
/var/log/netsec is the only host write.
sirius merged commit c0cf2925dc into master 2026-11-27 05:03:12 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sirius/homek8s!39
No description provided.