kube-audit-kit

Performs read-only Kubernetes security audits by exporting resources, sanitizing metadata, grouping applications by topology, and generating PSS/NSA-compliant audit reports. Use when the user requests auditing Kubernetes clusters, Namespaces, security reviews, or configuration analysis.

16 stars

Best use case

kube-audit-kit is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Performs read-only Kubernetes security audits by exporting resources, sanitizing metadata, grouping applications by topology, and generating PSS/NSA-compliant audit reports. Use when the user requests auditing Kubernetes clusters, Namespaces, security reviews, or configuration analysis.

Teams using kube-audit-kit should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/kube-audit-kit/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/testing-security/kube-audit-kit/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/kube-audit-kit/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How kube-audit-kit Compares

Feature / Agentkube-audit-kitStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Performs read-only Kubernetes security audits by exporting resources, sanitizing metadata, grouping applications by topology, and generating PSS/NSA-compliant audit reports. Use when the user requests auditing Kubernetes clusters, Namespaces, security reviews, or configuration analysis.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Kube Audit Kit - Read-Only Kubernetes Security Audit Toolkit

This Skill uses a standardized, scripted workflow to export Kubernetes cluster resources in **read-only** mode, sanitize them, group applications, and perform a deep security audit. The entire process strictly follows the **read-only** principle and does not modify any cluster state.

## Core Principles

- **Read-only**: only `get/list` operations, never `apply/patch/delete`
- **Full coverage**: dynamically discover all resource types without hardcoding lists
- **Scripted**: core logic runs through Python scripts for stability

## Quick Start

### Prerequisites

1. **Environment setup**:

   ```bash
   uv sync
   ```

   See [SETUP.md](SETUP.md) for details.

2. **Verify kubectl**:
   ```bash
   kubectl config get-contexts
   ```

### Run an audit

When a user requests an audit, follow these steps strictly:

**Set the output directory first** (important!):

```bash
# Set the output directory to output/ under the current working directory
# This ensures output files are generated in the user's working directory, not the SKILL install directory
export KUBE_AUDIT_OUTPUT="$(pwd)/output"
```

**Use the progress checklist**:

```
Audit progress:
- [ ] Step 1: Export - Dynamic discovery and full resource export
- [ ] Step 2: Sanitize - Remove metadata and status fields
- [ ] Step 3: Group - Associate applications by workload topology
- [ ] Step 4: Audit - Dual-layer security audit
```

#### Step 1: Export

```bash
# Keep the environment variable effective for each command
export KUBE_AUDIT_OUTPUT="$(pwd)/output" && \
uv run python scripts/export.py --context <context> --namespace <namespace>
```

Output: `{OUTPUT_BASE}/export/`

#### Step 2: Sanitize

```bash
export KUBE_AUDIT_OUTPUT="$(pwd)/output" && \
uv run python scripts/sanitize.py --context <context> --namespace <namespace>
```

Output: `{OUTPUT_BASE}/sanitize/`, `{OUTPUT_BASE}/sanitize_fields/`

#### Step 3: Group

```bash
export KUBE_AUDIT_OUTPUT="$(pwd)/output" && \
uv run python scripts/group_apps.py --context <context> --namespace <namespace>
```

Output: `{OUTPUT_BASE}/group/`, `{OUTPUT_BASE}/ungrouped_resources.txt`

#### Step 4: Audit

**Phase 1 - Script-based static scan**:

```bash
export KUBE_AUDIT_OUTPUT="$(pwd)/output" && \
uv run python scripts/audit.py --context <context> --namespace <namespace>
```

Output:

- `{OUTPUT_BASE}/audit/audit_results.json` - structured audit results
- `{OUTPUT_BASE}/audit/configmap_to_secret.csv` - ConfigMap sensitive data
- `{OUTPUT_BASE}/audit/secret_to_configmap.csv` - Secret non-sensitive data
- `{OUTPUT_BASE}/audit/rbac_issues.csv` - RBAC audit results
- `{OUTPUT_BASE}/audit/network_security.csv` - network security audit results
- `{OUTPUT_BASE}/audit/hostpath_mounts.csv` - hostPath mount findings
- `{OUTPUT_BASE}/audit/security_policies.csv` - seccomp/AppArmor results
- `{OUTPUT_BASE}/audit/pdb_and_secrets.csv` - PDB/Secret/ServiceAccount results

**Phase 2 - AI expert deep review**:

AI independently reviews results without relying on phase 1 output:

1. **Independent analysis**: traverse `{OUTPUT_BASE}/group/*/` and read all original YAML files
2. **Deep review**: identify risks not covered by script rules
   - business logic risks (e.g., plaintext private keys, hardcoded passwords)
   - architecture risks (e.g., missing NetworkPolicy, overly broad RBAC)
   - configuration drift risks (e.g., `latest` images, missing resource limits)
3. **Supplement findings**: if sensitive data was missed, append to the CSV files
4. **Report summary**: merge phase 1 findings with AI analysis into `{OUTPUT_BASE}/audit/audit_report.md`

**Report template**: see `audit_report_template.md` in the same directory.

**Key requirements**:

- Must read original YAML files, not just audit_results.json
- Every application must have specific analysis; avoid vague statements like "not reviewed"
- If script misses sensitive data, update the CSV files to keep data complete

## Output Structure

```
output/{context}/{namespace}/
├── export/              # raw export data
├── sanitize/            # sanitized data
├── sanitize_fields/     # sanitization records
├── group/               # application grouping
│   └── {app_name}/
│       ├── *.yaml            # grouped resource files
│       └── config_usage.json # CM/Secret usage record
├── ungrouped_resources.txt   # orphan resources
└── audit/               # audit results
    ├── audit_results.json        # static analysis results
    ├── configmap_to_secret.csv   # sensitive data in ConfigMaps
    ├── secret_to_configmap.csv   # non-sensitive data in Secrets
    ├── rbac_issues.csv            # RBAC audit results
    ├── network_security.csv       # network security audit results
    ├── hostpath_mounts.csv        # hostPath mount findings
    ├── security_policies.csv      # seccomp/AppArmor results
    ├── pdb_and_secrets.csv        # PDB/Secret/ServiceAccount results
    └── audit_report.md           # final AI-generated report
```

## Reference Docs

- **[QUICKSTART.md](QUICKSTART.md)**: 30-second quick start
- **[WORKFLOW.md](WORKFLOW.md)**: full workflow and implementation details
- **[SETUP.md](SETUP.md)**: environment setup and dependency installation
- **[EXAMPLES.md](EXAMPLES.md)**: output examples and typical scenarios

## User Interaction Conventions

### Planning Phase

```
Received. Target: Context `{ctx}`, Namespace `{ns}`.

Execution plan:
1. Set the output directory environment variable: export KUBE_AUDIT_OUTPUT="$(pwd)/output"
2. [Export] Dynamic discovery and full resource export → scripts/export.py
3. [Sanitize] Remove metadata and status fields → scripts/sanitize.py
4. [Group] Associate applications by workload topology → scripts/group_apps.py
5. [Audit] Dual-layer security audit (static scan + AI expert review) → scripts/audit.py

Output directory: $(pwd)/output/{ctx}/{ns}/

Start?
```

### Execution Phase

Output a summary after each step (each command must include the environment variable):

```
✅ [Export completed] Scanned 32 resource types, exported 150 YAMLs
   Output: output/{ctx}/{ns}/export/
```

### Results Phase

```
✅ [Audit completed] Static report and AI expert analysis merged

📊 Audit stats:
- Applications: 12
- Critical risks: X (see audit_results.json)
- Warning risks: Y
- Info recommendations: Z

📁 Output directory: output/{ctx}/{ns}/
📄 Full audit report: output/{ctx}/{ns}/audit/audit_report.md

⚠️ Security reminder: the output/ directory contains decrypted Secret data. Please delete it securely after the audit!
```

## Path Conventions

**{OUTPUT_BASE}** = `output/{context}/{namespace}/`

### Output path mechanism

All paths are computed by `get_output_paths()` in `scripts/utils.py`, with the following precedence:

1. **Environment variable `KUBE_AUDIT_OUTPUT`** (recommended)
   - Set in SKILL.md before running: `export KUBE_AUDIT_OUTPUT="$(pwd)/output"`
   - Ensures output files are created in the **user's working directory**
   - Avoids writing to the SKILL installation directory

2. **Current working directory** (fallback)
   - If the environment variable is not set, use `Path.cwd() / "output"`
   - Note: when a SKILL runs, cwd may be the SKILL directory

### Why the environment variable?

When the SKILL is invoked, the Agent switches to the SKILL installation directory to run scripts. Using `Path.cwd()` directly would write to the wrong location.

By setting `KUBE_AUDIT_OUTPUT="$(pwd)/output"` before each command, you ensure:
- `$(pwd)` resolves to the user's working directory
- Python scripts read the environment variable and write to the intended path
- Output always lands in the user's working directory, regardless of where the SKILL is called

## Key Design Decisions

### Volume vs EnvVar distinction

ConfigMaps/Secrets usage determines whether sensitive data is scanned:

- **Volume mount**: skip sensitive scanning (treated as application config files)
- **EnvVar reference**: scan for sensitive data (may include passwords/keys)

`config_usage.json` records the usage type for each ConfigMap/Secret.

### Permission error handling

Scripts use a fault-tolerant approach:

- If a single resource type is denied, skip it and show a warning
- Other resource types continue normally
- The final report notes which checks are missing due to insufficient permissions

Use a dedicated audit service account (see [SETUP.md](SETUP.md)).

## Security Reminder

**Warning**: the `output/` directory contains decrypted Secret data.

**After the audit**:

- Keep `audit_report.md` (it does not contain sensitive data)
- Securely delete other directories or store them encrypted
- Do not commit `output/` to version control

Related Skills

php-security-audit

16
from diegosouzapw/awesome-omni-skill

Analyze a PHP web application or codebase for security vulnerabilities and OWASP compliance. Use when the user asks to audit, check, review, or analyze the security, vulnerabilities, OWASP compliance, or hardening of a PHP, Laravel, Kirby, Livewire, or Blade application. Also use when the user mentions "securite", "security", "OWASP", "injection SQL", "XSS", "CSRF", "faille", "vulnerabilite", "pentest", "hardening", "authentication", or "authorization". Specialized for PHP, Laravel, Kirby CMS, Livewire, Blade, Vite, Tailwind CSS, and SQL databases.

performing-cryptographic-audit-of-application

16
from diegosouzapw/awesome-omni-skill

A cryptographic audit systematically reviews an application's use of cryptographic primitives, protocols, and key management to identify vulnerabilities such as weak algorithms, insecure modes, hardco

nobrainer-fast-audit

16
from diegosouzapw/awesome-omni-skill

Universal security diagnostic skill for Claude Code. Audits system security posture, vets skills/plugins before installation, scans for indicators of compromise, and provides OWASP Agentic Top 10 hardening guidance. Cross-platform: macOS, Linux, Windows, VPS. Use on: /safety-audit, /safety-check-skill, /safety-scan.

memory-leak-audit

16
from diegosouzapw/awesome-omni-skill

Audit code for memory leaks and disposable issues. Use when reviewing event listeners, DOM handlers, lifecycle callbacks, or fixing leak reports. Covers addDisposableListener, Event.once, MutableDisposable, DisposableStore, and onWillDispose patterns.

ln-634-test-coverage-auditor

16
from diegosouzapw/awesome-omni-skill

Coverage Gaps audit worker (L3). Identifies missing tests for critical paths (Money 20+, Security 20+, Data Integrity 15+, Core Flows 15+). Returns list of untested critical business logic with priority justification.

laravel-security-audit

16
from diegosouzapw/awesome-omni-skill

Security auditor for Laravel applications. Analyzes code for vulnerabilities, misconfigurations, and insecure practices using OWASP standards and Laravel security best practices.

jules-audit-request

16
from diegosouzapw/awesome-omni-skill

Protocol for escalation to Jules when stuck.

hypeauditor-automation

16
from diegosouzapw/awesome-omni-skill

Automate Hypeauditor tasks via Rube MCP (Composio). Always search tools first for current schemas.

hlab-auditor

16
from diegosouzapw/awesome-omni-skill

No description provided.

gtse-ecommerce-seo-audit

16
from diegosouzapw/awesome-omni-skill

Comprehensive BigCommerce SEO audit for product pages, collection pages, technical SEO, and B2B considerations. Use when GTSE needs SEO audits for their cable ties, safety equipment, and industrial supplies categories. Adapted for B2B ecommerce with trade customer focus.

gdpr-auditor

16
from diegosouzapw/awesome-omni-skill

This skill should be used when analyzing codebases, applications, databases, or systems for GDPR (General Data Protection Regulation) compliance. Use this skill when users need to audit data protection practices, identify potential compliance issues, assess data handling procedures, review privacy policies, or ensure adherence to EU data protection requirements.

five-s-auditor

16
from diegosouzapw/awesome-omni-skill

5S workplace organization audit skill with scoring, photo documentation, and sustainability tracking.