docs(k8s): add pktvisor sidecar deployment example (#743)#788
Conversation
|
@codex review |
There was a problem hiding this comment.
Pull request overview
Adds a runnable Kubernetes example to deploy pktvisord as a sidecar within a pod so it can observe the pod’s eth0 traffic and expose Prometheus metrics for scraping via pod annotations. This extends the repo’s operational documentation/examples without changing the agent code or build pipeline.
Changes:
- Introduces a new
k8s/directory containing a sidecar-based Deployment manifest forpktvisord. - Adds step-by-step documentation for deploying, verifying metrics, generating demo traffic, and configuring Prometheus scraping.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| k8s/README.md | Documents how to deploy/verify a pktvisord sidecar and configure Prometheus scraping via annotations. |
| k8s/pktvisor-sidecar.yaml | Provides a Deployment manifest with an app container, optional traffic generator, and a pktvisord sidecar exposing /metrics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 912dd42ee3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
LCOV of commit
|
…th and pod SD dedup (#743)
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9a859e3c46
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…gex; portable iface lookup (#743)
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7ac5c4df3c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5d6ec1dfa2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Refs #743. (Does not auto-close the issue — see discussion there.)
What
Adds a runnable, documented Kubernetes example under a new top-level
k8s/directory that runspktvisordas a sidecar observing a pod'seth0traffic, scraped by Prometheus via pod annotations. Docs/example only — no C++, image, or CI changes.k8s/pktvisor-sidecar.yaml— apktvisor-demoDeployment whose pod shares one network namespace across three containers:app(nginx placeholder workload), an optionaltraffic-gen(busyboxwgetloop, clearly fenced as removable), and thepktvisordsidecar (capture oneth0,/metricson:10853).k8s/README.md— deploy / verify / generate-traffic / Prometheus scrape config / Grafana dashboard / adapt-to-your-workload / security notes.Why a sidecar
pktvisordcaptures via libpcap/AF_PACKET in promiscuous mode, so it needsCAP_NET_RAW+CAP_NET_ADMINand must run in the network namespace of the interface it monitors. Containers in a pod share one netns, so apktvisordsidecar sees the app container'seth0. (A standalone pod would only see its own near-empty traffic; ahostNetworkDaemonSet would see node-wide traffic, not a pod's.)Three load-bearing manifest details (each verified against the source)
pktvisord— the imageENTRYPOINT(/entry-cp.sh) selects the binary from the first arg.-l 0.0.0.0— the web/metrics server defaults to bindinglocalhost(cmd/pktvisord/main.cpp), so without this Prometheus could not reachPOD_IP:10853.-H $(POD_IP)/32—-Hrequires a CIDR; a bare IP throwsinvalid CIDR(parse_host_specsinlibs/visor_utils/utils.cpp) and crash-loops.$(POD_IP)is injected via the downward API (fieldRef: status.podIP) on the same container, so Kubernetes substitutes it inargs. Use/128on IPv6 clusters.Security: the sidecar adds
NET_RAW+NET_ADMIN(neverprivileged) —NET_RAWopens the raw/AF_PACKET socket andNET_ADMINis needed for promiscuous capture, matching pktvisord's documentedsetcap cap_net_raw,cap_net_admin. Both are rejected by the PodSecuritybaseline/restrictedlevels, so the namespace needs theprivilegedlevel or an exemption.Validation
python3YAML parse +kubectl apply --dry-run=clientboth pass:The example is not run against a live cluster in CI; the README documents the port-forward +
curl /metricsverification for users.Reviews
Built spec → plan → adversarial review (which corrected two example-breaking bugs before they shipped: the bare-IP CIDR crash and the localhost bind). Execution was subagent-driven: per-file implementation, a 3-lens adversarial review each (k8s-schema validity with real
kubectldry-run, pktvisord runtime-correctness checked againstentry-cp.sh/main.cpp/utils.cpp, spec compliance / README↔manifest consistency / Prometheus scrape-config correctness / technical accuracy), and a whole-branch final review. All passed with no blocking findings.🤖 Generated with Claude Code