k8scan GitHub
Python 3.8+ K8s 1.20+ Tested on Kubernetes-Goat

Kubernetes Security
Scanner.

An advanced Kubernetes vulnerability scanner that identifies critical misconfigurations, supply chain risks, and container escapes. Built to support DevSecOps workflows, it provides security teams with actionable Proof-of-Concept (PoC) commands and an interactive HTML dashboard.

bash - k8scan

k8scan scan --namespace production --severity CRITICAL

[*] Initializing Kubernetes Security Scanner v1.0...

[*] Target Namespace: production


[!] CRITICAL: Privileged Pod Detected

Pod: api-gateway-core

Risk: Container Escape / Host Compromise


[+] Automated PoC Generated:

kubectl exec -it api-gateway-core -n production -- nsenter -t 1 -m -u -n -i sh


[+] Scan complete. Found 1 critical vulnerability.

[+] HTML report saved to: reports/security-audit.html

Interactive HTML Dashboard

Beautiful, collapsible reports with color-coded severity indicators. Easily share findings with your team.

localhost:8000/reports/security-audit.html
k8scan HTML Report
Dashboard Screenshot Goes Here

Key Features

Safe & Read-Only

Exclusively performs read operations, making it 100% safe for production environments.

Executive Summary

High-level overview with attack surface analysis and detailed scoring.

Risk Scoring

0-100 security rating with category-specific breakdowns (RBAC, Network, CLI, etc.).

Beautiful Reports

Collapsible, portable HTML reports with color-coded severity indicators.

Progress Tracking

Real-time visual progress bars directly in the terminal during scanning.

Secure File Server

Share generated HTML reports seamlessly using the built-in HTTP server (serve command).

Installation & Usage

Quick Install (Local)

git clone https://github.com/alperenkesk/k8scan.git

cd k8scan

pip install -r requirements.txt

pip install -e .

Docker Installation

docker build -t k8scan .

docker run -v ~/.kube:/root/.kube:ro k8scan scan

Usage Examples

# Basic scan (safe, read-only)

k8scan scan --exclude-system

# Full cluster scan with all formats

k8scan scan --output all -f security-audit

# Serve generated reports securely

k8scan serve reports/security-audit.html reports/security-audit.json

🛠 Scenarios

1. Production Environment Check (Safe)

Run a read-only scan focusing on critical issues in the production namespace.

k8scan scan --namespace production --severity CRITICAL --output all

2. Weekly Security Audit

Generate a comprehensive HTML report excluding system namespaces, and directly serve it.

k8scan scan --exclude-system --output html -f weekly-audit --serve --port 9000

3. CI/CD Pipeline (JSON Output)

Export findings in a machine-readable format for downstream analysis or alerting.

k8scan scan --severity CRITICAL --output json