--cgroup and --namespace. Both are first-class filters on files, transfers, processes, connections, flows and watch.
Run the agent on the host, not in a container
The agent loads eBPF programs and needs the host’s PID namespace to see every container’s processes. Runfiletrace-agent as the packaged service on the node. An agent inside a container, even privileged, sees only its own namespace.
Find a container’s cgroup
Every process has a cgroup, and its directory in the cgroup tree identifies it:Filter by namespace
--namespace takes the inode number of a network, PID or mount namespace:
Rank containers by egress
--include-children matters in containers: a shell, a runtime and a worker are separate processes, and folding descendants into the parent’s totals shows the pod, not the pieces.
What the metrics show
Theprocess_executable_name label is the kernel’s name for the process, at most 15 bytes. It does not carry the container or pod name. To get per-container metrics, join the Filetrace series with your container metadata on the host and the process:
process.pid, plus filetrace.socket.id to follow a transfer to its endpoints. Join process.pid against container_process-style metrics from cAdvisor or the kubelet, or against the cgroup ID, to attribute transfers to a pod.
A worked example
A node runs an upload service and a database. Something is sending a large backup off the node.INFERRED because pg_dump reads the file and writes it to the socket, which is expected for a dump stream.
Where the answer can mislead
- Short-lived processes. A process that exits before the agent reads its cgroup can show without one.
process_executable_namestill names it. - Host networking. Pods that share the host network namespace cannot be told apart by
--namespace; use--cgroupor the PID. - A sidecar proxy sends on behalf of the application. The transfer is attributed to the proxy’s process, so name the intended service by the socket’s local port or by the script.
- Namespaces are reused after a pod restarts, so a namespace inode identifies a pod only for its lifetime. For long-term attribution, log the PID and cgroup with the transfer.
Related pages
- Filter options —
--cgroupand--namespacesyntax. filetrace processes—--include-children, rates per process.- Data model — how processes, sockets and transfers link.