Skip to content

feat(kubernetes): pod and container attribution for connections#299

Open
domcyrus wants to merge 1 commit into
mainfrom
feat/kubernetes-attribution
Open

feat(kubernetes): pod and container attribution for connections#299
domcyrus wants to merge 1 commit into
mainfrom
feat/kubernetes-attribution

Conversation

@domcyrus
Copy link
Copy Markdown
Owner

Add an optional kubernetes feature (off by default, no extra dependencies) that attributes connections to their owning pod and container on a node:

  • cgroup parser maps a PID to pod UID + container ID via /proc//cgroup
  • cross-namespace socket-table walker reads per-PID /proc//net/{tcp,udp}, which is netns-aware, so pod-owned sockets are attributed under hostNetwork
  • pod/container names resolved from the kubelet log directories (/var/log/containers, /var/log/pods): runtime-agnostic, no CRI socket and no kubelet auth
  • surfaced in the TUI details pane, JSONL and PCAP exports, and the pod:, ns:, container: filter keywords

The container image enables the feature by default via the CARGO_FEATURES build-arg; native installs stay default-off.

@domcyrus domcyrus force-pushed the feat/kubernetes-attribution branch 2 times, most recently from 474a631 to 209a1f9 Compare May 21, 2026 19:12
Add an optional `kubernetes` feature (off by default, no extra dependencies)
that attributes connections to their owning pod and container on a node:

- cgroup parser maps a PID to pod UID + container ID via /proc/<pid>/cgroup
- cross-namespace socket-table walker reads per-PID /proc/<pid>/net/{tcp,udp},
  which is netns-aware, so pod-owned sockets are attributed under hostNetwork
- pod/container names resolved from the kubelet log directories
  (/var/log/containers, /var/log/pods): runtime-agnostic, no CRI socket and no
  kubelet auth
- surfaced in the TUI details pane, JSONL and PCAP exports, and the pod:, ns:,
  container: filter keywords
- `--kubernetes <auto|on|off>` controls it at runtime; `auto` (the default)
  enables only when running inside a pod, detected via KUBERNETES_SERVICE_HOST
- Landlock read access extended to the kubelet log dirs when enabled, so name
  resolution keeps working under the sandbox

The container image is built with the feature enabled (CARGO_FEATURES build-arg);
native installs (cargo/brew/deb/rpm) leave it off and stay lean.
@domcyrus domcyrus force-pushed the feat/kubernetes-attribution branch from 209a1f9 to 8bed755 Compare May 21, 2026 19:53
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