Implement support for tracing multiple containers within a single
Kubernetes pod. This completes Milestone 4.
Changes:
- Add -cgroups flag for comma-separated cgroup paths
- Maintain backwards compatibility with -cgroup flag
- Add CgroupPaths []string field to Config
- Create helper utilities for container discovery
- Add comprehensive tests (all passing)
- Document multi-container usage patterns
- Include complete working example manifest
The implementation supports up to 64 containers per pod (eBPF map limit)
and allows selective tracing of specific containers while excluding
others (e.g., snoop's own container).
Files:
- pkg/config/config.go: Add CgroupPaths field and parsing
- cmd/snoop/main.go: Add -cgroups flag and multi-cgroup initialization
- pkg/cgroup/multi_container.go: Container discovery utilities
- pkg/config/config_test.go: Comprehensive test coverage
- deploy/kubernetes/README.md: Multi-container documentation
- deploy/kubernetes/multi-container-example.yaml: Working example
- MULTI_CONTAINER_SUPPORT.md: Implementation guide
- plan.md: Mark Milestone 4 complete
Signed-off-by: Jason Hall <jason@chainguard.dev>
Create comprehensive Kubernetes deployment resources:
- deployment.yaml: Example deployment with snoop sidecar
- rbac.yaml: ServiceAccount and ClusterRole for required permissions
- example-app.yaml: Complete nginx example showing sidecar integration
- README.md: Extensive documentation with quick start, configuration,
troubleshooting, and best practices
Manifests include:
- Security context with minimal required capabilities
- Init container for cgroup discovery
- Health probes and metrics endpoints
- Resource limits and requests
- Prometheus annotations for scraping
Completes first deliverable of Milestone 4 (Kubernetes Integration).
Signed-off-by: Jason Hall <jason@chainguard.dev>