
k8s-sec-agent
ContributedKubernetes security audit agent for kagent that checks CIS benchmarks, pod security, RBAC, and network policies with privacy-preserving pseudonymization
A Kubernetes security audit agent that runs as a declarative agent in kagent. It audits clusters against CIS security benchmarks using MCP tools, with built-in privacy-preserving pseudonymization so sensitive cluster data never reaches the LLM in plain text.
What it does
- Runs CIS Kubernetes Benchmark checks via kube-bench as in-cluster Jobs
- Scans all pods for security issues: privileged containers, running as root, missing resource limits, writable root filesystems
- Checks network policy coverage per namespace to find unprotected workloads
- Analyzes RBAC bindings for cluster-admin usage and overpermissive service accounts
- Executes arbitrary kubectl commands (with human-in-the-loop approval) for deep-dive investigations
- Produces a scored security posture report with prioritized findings and copy-pasteable remediation
How it works
The agent exposes five MCP tools through a FastMCP server. All tool outputs are pseudonymized before the LLM sees them — namespace names, pod names, IPs, service accounts, and secrets are replaced with scoped tokens (e.g., ns-a3f2-1, pod-a3f2-3). An OpenAI-compatible reverse proxy sits in front of the upstream LLM, rehydrating pseudonymized tokens in the response before it reaches the user. Each session gets its own sanitizer with a unique scope, ensuring multi-tenant isolation. Deployed via Helm chart into any kagent-enabled cluster.