Skip to content

fix(node-metrics): keep pods whose netns AppArmor blocks on the procdev fallback - #1442

Merged
beneiltis merged 1 commit into
mainfrom
fix/node-metrics-blocked-netns
Nov 13, 2026
Merged

beneiltis merged 1 commit into
mainfrom
fix/node-metrics-blocked-netns

Conversation

@beneiltis

Copy link
Copy Markdown
Contributor

Problem (regression from #1439)

After rolling out 2.35.0-develop.855 on homeserver, two privileged pods lost their traffic metrics entirely (lwz-monitor on homeserver, kured on relay):

ERROR network-monitor networkmonitor.go:104 failed to register snoopy {"error":[{}],"podInfo":{"Namespace":"lwz-monitor",...}}

podNetnsTarget (new in #1439) only accepts a container whose /proc/$pid/ns/net can be stat'ed. node-metrics runs under the cri-containerd.apparmor.d profile, which denies the ptrace read on unconfined processes, i.e. those of privileged pods:

apparmor="DENIED" operation="ptrace" profile="cri-containerd.apparmor.d" comm="mogenius-operat" requested_mask="read" peer="unconfined"

Checked under that profile on homeserver: stat /proc/<pid>/ns/net → Permission denied, /proc/<pid>/net/dev → readable, no denial. Before #1439 such a pod still got a handle; nsenter failed, and Metrics() served it from /proc/$pid/net/dev. Since #1439 it was dropped.

Fix

  • Only a missing namespace (ErrNotExist, vanished first process) skips a container. A blocked one is still registered, so the pod is back on the procdev fallback like before.
  • Register/Remove errors are logged through errors.Join instead of as a []error that marshals to [{}].

Rest of the rollout check (homeserver, develop.855)

  • 61 snoopy processes, 10.3 MB PSS (before: 62, 29 MB), 62 update_tc_ingress + 62 update_tc_egress attached via tcx, no XDP, lo untouched, host veth keeps tx-tcp-segmentation: on
  • traffic is plausible: source-controller tx 54 MB ≈ kustomize-controller rx 62 MB (Flux artifact download), valkey rx/tx 29/29 MB
  • AppArmor ptrace denials from node-metrics: old process ~1/s (1027 in the ring buffer), new process 1 since start (the per-process scan now runs only with a live viewer)

go build, go vet, golangci-lint clean.

🤖 Generated with Claude Code

…ev fallback

podNetnsTarget rejected a pod when no container's /proc/$pid/ns/net could
be stat'ed. For privileged pods that is not a vanished process but an
AppArmor denial: node-metrics runs under cri-containerd.apparmor.d, which
denies the ptrace read on unconfined processes. Before #1439 such pods
still got a handle and their traffic from /proc/$pid/net/dev (allowed by
the profile); since then they got no traffic at all (seen for
lwz-monitor on homeserver and kured on relay).

Only a missing namespace skips a container now; a blocked one is still
registered. Register/Remove errors are logged as text instead of `{}`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@beneiltis
beneiltis merged commit fc99841 into main Nov 13, 2026
3 checks passed
@beneiltis
beneiltis deleted the fix/node-metrics-blocked-netns branch November 13, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant