# k8s-sec-agent

> Kubernetes security audit agent for kagent that checks CIS benchmarks, pod security, RBAC, and network policies with privacy-preserving pseudonymization

- Type: Agent
- Author: mostafahussein
- License: Apache-2.0
- Trust tier: contributed (passed automated validation and a baseline maintainer review)
- Last reviewed: 2026-09-03
- Source repository: https://github.com/mostafahussein/k8s-sec-agent
- Repo state: not archived
- Last push: 2026-09-16T16:25:40Z
- Stars: 1 (a popularity signal, not a safety signal)
- Forks: 0 (a popularity signal, not a safety signal)
- Open issues: 0
- Language: Python
- Health checked at: 2026-11-05T20:35:15.821Z
- Domains: cloud-security
- Tags: kubernetes, security, cis-benchmark, kube-bench, rbac, network-policy, audit, mcp, kagent
- Date added: 2026-09-03
- Listing page: https://exchange.tenable.com/agents/k8s-sec-agent
- Source file: https://github.com/tenable/cyberagents-exchange/blob/main/agents/k8s-sec-agent.md

A Kubernetes security audit agent that runs as a declarative agent in [kagent](https://github.com/kagent-dev/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](https://github.com/aquasecurity/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.

This is the Markdown version of one of 140 listings on CyberAgents Exchange. The same listing as JSON: https://exchange.tenable.com/api/agents/k8s-sec-agent.json. The full index and how to read it: https://exchange.tenable.com/llms.txt
