← Back to posts
comparison guide self-hosted · · 12 min read

Kube-Bench vs Trivy vs Kubescape: Container & Kubernetes Hardening Guide 2026

Compare the best open-source container and Kubernetes hardening tools — kube-bench, Trivy, and Kubescape — with Docker configs, installation guides, and CIS compliance benchmarks.

OS
Editorial Team

Running containers and kubernetes clusters in production without security scanning is like leaving your server’s front door unlocked. Misconfigurations, outdated base images, overly permissive RBAC policies, and exposed secrets are the top causes of container breaches. The good news: you don’t need expensive commercial tools to catch them.

This guide compares three leading open-source hardening and scanning tools that cover different layers of your container and Kubernetes stack: kube-bench (CIS compliance auditing), Trivy (vulnerability + misconfiguration scanning), and Kubescape (comprehensive Kubernetes security platform).

Why Harden Your Container and Kubernetes Infrastructure?

Container orchestration has become the standard for deploying applications at scale. But with that complexity comes a dramatically expanded attack surface:

  • CIS Benchmarks: The Center for Internet Security publishes detaildockerdening guides for Docker and Kubernetes. Following them prevents hundreds of known misconfigurations.
  • Supply chain risk: Every container image pulls in dozens of dependencies. A single vulnerable package can compromise your entire cluster.
  • Runtime exposure: Default Kubernetes configurations often allow privilege escalation, host network access, and unrestricted pod-to-pod communication.
  • Compliance requirements: SOC 2, HIPAA, PCI DSS, and ISO 27001 all require evidence of infrastructure security scanning.

Self-hosting these scanning tools gives you full control over scan data, scheduling, and integration into your CI/CD pipelines — without sending sensitive infrastructure details to third-party SaaS platforms.

Tool Comparison at a Glance

Featurekube-benchTrivyKubescape
Primary focusCIS Kubernetes Benchmark complianceVulnerability + misconfiguration scanningFull Kubernetes security platform
LanguageGoGoGo
GitHub stars8,02234,61211,315
Last updatedApril 2026April 2026April 2026
CIS Docker BenchmarkNoPartial (image-level)No
CIS Kubernetes BenchmarkYes (EKS, GKE, AKS, vanilla)Yes (via misconfig checks)Yes (plus MITRE ATT&CK, NSA/CISA)
Image vulnerability scanningNoYes (OS packages, language deps)Yes (via integration)
YAML/Helm chart scanningNoYesYes
RBAC analysisPartialNoYes
Network policy analysisNoNoYes
Runtime scanningNoNoYes (eBPF-based)
CI/CD integrationYes (binary, Docker)Yes (binary, Docker, GitHub Action)Yes (binary, Docker, Helm, GitHub Action)
Report formatsJSON, YAML, JUnitJSON, SARIF, CycloneDX, tableJSON, PDF, HTML, Prometheus metrics
LicenseApache 2.0Apache 2.0Apache 2.0

kube-bench: CIS Kubernetes Benchmark Compliance

kube-bench by Aqua Security is the gold standard for CIS Kubernetes Benchmark compliance checking. It runs 100+ individual checks against your cluster configuration, covering control plane components, etcd, worker nodes, and Kubernetes policies.

What kube-bench Checks

kube-bench organizes its checks into six CIS benchmark sections:

  1. Control Plane Components — API server, controller manager, scheduler configuration
  2. etcd — Encryption at rest, TLS configuration, access controls
  3. Control Plane Configuration — RBAC, Pod Security Standards, admission controllers
  4. Worker Nodes — Kubelet configuration, file permissions, authentication
  5. Kubernetes Policies — Network policies, RBAC roles, secrets management
  6. Managed Services — EKS, GKE, and AKS specific hardening checks

Each check maps to a specific CIS control ID (e.g., 1.1.1 — “Ensure that the API server pod specification file permissions are set to 600 or more restrictive”).

Installation

Binary download:

1
2
3
4
# Latest release
curl -L https://github.com/aquasecurity/kube-bench/releases/download/v0.7.4/kube-bench_0.7.4_linux_amd64.tar.gz -o kube-bench.tar.gz
tar -xzf kube-bench.tar.gz
sudo mv kube-bench /usr/local/bin/

Docker:

1
docker run --rm -v $(pwd):/home aquasec/kube-bench:latest --benchmark cis-1.24

Kubernetes Job (scan your own cluster):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
apiVersion: batch/v1
kind: Job
metadata:
  name: kube-bench
spec:
  template:
    spec:
      hostPID: true
      containers:
        - name: kube-bench
          image: docker.io/aquasec/kube-bench:latest
          command: ["kube-bench"]
          volumeMounts:
            - name: var-lib-etcd
              mountPath: /var/lib/etcd
              readOnly: true
            - name: var-lib-kubelet
              mountPath: /var/lib/kubelet
              readOnly: true
            - name: var-lib-kube-scheduler
              mountPath: /var/lib/kube-scheduler
              readOnly: true
            - name: var-lib-kube-controller-manager
              mountPath: /var/lib/kube-controller-manager
              readOnly: true
            - name: etc-systemd
              mountPath: /etc/systemd
              readOnly: true
            - name: lib-systemd
              mountPath: /lib/systemd
              readOnly: true
            - name: srv-kubernetes
              mountPath: /srv/kubernetes
              readOnly: true
            - name: etc-kubernetes
              mountPath: /etc/kubernetes
              readOnly: true
      restartPolicy: Never
      volumes:
        - name: var-lib-etcd
          hostPath:
            path: "/var/lib/etcd"
        - name: var-lib-kubelet
          hostPath:
            path: "/var/lib/kubelet"
        - name: var-lib-kube-scheduler
          hostPath:
            path: "/var/lib/kube-scheduler"
        - name: var-lib-kube-controller-manager
          hostPath:
            path: "/var/lib/kube-controller-manager"
        - name: etc-systemd
          hostPath:
            path: "/etc/systemd"
        - name: lib-systemd
          hostPath:
            path: "/lib/systemd"
        - name: srv-kubernetes
          hostPath:
            path: "/srv/kubernetes"
        - name: etc-kubernetes
          hostPath:
            path: "/etc/kubernetes"

Running a CIS Scan

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Run against default cluster context
kube-bench

# Target a specific benchmark
kube-bench --benchmark cis-1.24

# Run a specific section (e.g., worker nodes only)
kube-bench --targets node

# Output as JSON for pipeline integration
kube-bench --json > kube-bench-results.json

# Filter only failed checks
kube-bench --json | jq '.[] | select(.total_fail > 0)'

Sample Output

1
2
3
4
5
6
7
8
9
[INFO] 1 Control Plane Security Configuration
[WARN] 1.1.12 Ensure that the etcd data directory ownership is set to etcd:etcd
[WARN] 1.1.14 Ensure that the etcd data directory permissions are set to 700 or more restrictive
[INFO] 2 Etcd Node Configuration
[PASS] 2.1 Ensure that the --cert-file and --key-file arguments are set as appropriate
[INFO] 3 Control Plane Configuration
[PASS] 3.1.1 Client certificate authentication should not be used for users
[INFO] 4 Worker Node Security Configuration
[WARN] 4.2.1 Ensure that the anonymous-auth argument is set to false

kube-bench outputs a clear pass/warn/fail for each CIS control, making it ideal for compliance reporting and automated gate checks.

Trivy: All-in-One Vulnerability and Misconfiguration Scanner

Trivy is the most comprehensive open-source security scanner in the cloud-native ecosystem. Originally built as a container image vulnerability scanner, it has expanded to cover Kubernetes clusters, Infrastructure as Code, SBOM generation, and secret detection.

With over 34,000 GitHub stars, Trivy is the most actively maintained and widely adopted tool in this comparison.

What Trivy Scans

  • Container images — OS packages (Alpine, Debian, RHEL), language-specific dependencies (Python pip, Node.js npm, Java Maven, Go modules)
  • Kubernetes clusters — Misconfigurations against CIS benchmarks, vulnerable workloads, exposed secrets
  • Filesystem — Local directories for vulnerability scanning
  • Git repositories — Scan repos for secrets and vulnerabilities
  • IaC files — Terraform, CloudFormation, Dockerfile, Kubernetes YAML, Helm charts
  • SBOM generation — CycloneDX and SPDX format software bills of materials

Installation

Binary:

1
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin

Docker:

1
2
3
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
  -v $HOME/.cache/trivy:/root/.cache/ aquasec/trivy:latest \
  image alpine:3.19

Kubernetes (Cluster Scan):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
apiVersion: batch/v1
kind: Job
metadata:
  name: trivy-k8s-scan
spec:
  template:
    spec:
      serviceAccountName: trivy-sa
      containers:
        - name: trivy
          image: aquasec/trivy:latest
          command: ["trivy", "k8s", "--report", "summary"]
          env:
            - name: TRIVY_CACHE_DIR
              value: "/tmp/trivy"
      restartPolicy: Never
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: trivy-reader
rules:
  - apiGroups: [""]
    resources: ["pods", "nodes", "namespaces", "configmaps", "secrets", "services"]
    verbs: ["get", "list"]
  - apiGroups: ["apps"]
    resources: ["deployments", "daemonsets", "statefulsets"]
    verbs: ["get", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: trivy-reader-binding
subjects:
  - kind: ServiceAccount
    name: trivy-sa
    namespace: default
roleRef:
  kind: ClusterRole
  name: trivy-reader
  apiGroup: rbac.authorization.k8s.io

Running Scans

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# Scan a container image
trivy image nginx:latest

# Scan with severity filter
trivy image --severity HIGH,CRITICAL nginx:latest

# Scan Kubernetes cluster
trivy k8s --report summary

# Scan Terraform files
trivy config ./terraform/

# Scan for secrets in a directory
trivy fs --scanners secret ./project/

# Generate SBOM
trivy image --format spdx-json --output sbom.json nginx:latest

# CI-friendly: exit code 1 if vulnerabilities found
trivy image --exit-code 1 --severity CRITICAL myapp:latest

Kubernetes Misconfiguration Checks

Trivy’s Kubernetes scanning checks against multiple frameworks:

1
2
3
4
5
6
7
8
# CIS Kubernetes Benchmark
trivy k8s --compliance k8s-cis-1.24

# Pod Security Standards (PSS)
trivy k8s --compliance k8s-pss-baseline

# NSA/CISA Kubernetes Hardening Guide
trivy k8s --compliance k8s-nsa-1.0

This makes Trivy a compelling replacement for the now-inactive kube-hunter project — it covers both vulnerability hunting and configuration compliance in a single tool.

Kubescape: Comprehensive Kubernetes Security Platform

Kubescape is the most feature-rich option in this comparison. It goes beyond CIS benchmark checking to cover MITRE ATT&CK for Kubernetes, the NSA/CISA Kubernetes Hardening Guide, and custom organizational policies. It also provides continuous monitoring, RBAC visualization, and network policy analysis.

What Kubescape Does Differently

Kubescape’s architecture includes several unique capabilities:

  • Multi-framework scanning — Run CIS, MITRE ATT&CK, NSA/CISA, and SOC2 compliance checks in a single scan
  • RBAC visualization — Visualize and audit role bindings, cluster roles, and privilege escalation paths
  • Network policy analysis — Identify pods without network policies and map network communication paths
  • Repository scanning — Scan Helm charts and Kustomize overlays in your Git repos before deployment
  • Continuous monitoring — Deploy as a cluster operator for ongoing security posture tracking
  • Prometheus metrics — Export compliance scores as Prometheus metrics for Grafana dashboards

Installation

Binary:

1
curl -s https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash

Helm chart (continuous monitoring):

1
2
3
helm repo add kubescape https://kubescape.github.io/helm-charts
helm install kubescape kubescape/kubescape-operator \
  --namespace kubescape --create-namespace

Docker:

1
2
3
4
docker run --rm -v $HOME/.kube/config:/root/.kube/config \
  -v /var/run/docker.sock:/var/run/docker.sock \
  quay.io/kubescape/kubescape:latest \
  scan --verbose

Running Scans

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# Scan current cluster context against all frameworks
kubescape scan

# Scan specific framework
kubescape scan --framework CIS

# Scan MITRE ATT&CK framework
kubescape scan --framework "MITRE"

# Scan specific namespace
kubescape scan --include-namespaces production

# Scan YAML files (CI/CD)
kubescape scan *.yaml --verbose

# Output as JSON with vulnerability details
kubescape scan --format json --output results.json

# Scan Helm chart
kubescape scan helm://./my-chart/

RBAC Visualization

One of Kubescape’s standout features is its ability to map and visualize RBAC policies:

1
2
3
4
5
6
7
8
# List all RBAC risks
kubescape list controls

# Show specific control details
kubescape list controls --control "List and watch secrets"

# View RBAC visualization
kubescape rbac-visualizer

This is particularly valuable for auditing who has access to what in large clusters with dozens of namespaces and hundreds of service accounts.

Docker Bench for Security: Don’t Forget Container-Level Hardening

While kube-bench, Trivy, and Kubescape focus on Kubernetes, the Docker Bench for Security checks Docker daemon and container configurations against the CIS Docker Benchmark. If you run Docker directly (without Kubernetes), this is essential.

Docker Compose Configuration

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
services:
  docker-bench-security:
    build: .
    cap_add:
      - audit_control
    labels:
      - docker_bench_security
    pid: host
    stdin_open: true
    tty: true
    volumes:
      - /var/lib:/var/lib:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /usr/lib/systemd:/usr/lib/systemd:ro
      - /etc:/etc:ro

Running Docker Bench

1
2
3
4
5
6
7
8
# Run all checks
docker-compose run docker-bench-security

# Exclude specific checks
docker-compose run docker-bench-security -e docker_enterprise_configuration

# Run specific checks only
docker-compose run docker-bench-security -c docker_bench_security

The tool produces a detailed report with WARN/PASS/NOTE for each CIS Docker Benchmark control, covering daemon configuration, container runtime settings, image security, and Docker file permissions.

Choosing the Right Tool for Your Stack

ScenarioRecommended Tool
CIS compliance audit for Kuberneteskube-bench — purpose-built for CIS benchmarks
Full vulnerability scanning pipelineTrivy — best image scanning + multi-surface coverage
Continuous Kubernetes security monitoringKubescape — operator mode + multi-framework + RBAC
CI/CD image scanning gateTrivy — fast, exit-code support, CI integrations
Docker-only environmentsDocker Bench for Security — CIS Docker Benchmark
Compliance across multiple frameworksKubescape — CIS + MITRE + NSA/CISA in one scan
Pre-deployment YAML/Helm validationTrivy or Kubescape — both support file scanning
SBOM generation for supply chainTrivy — CycloneDX and SPDX output

For most teams, the ideal setup combines two tools:

  1. Trivy in CI/CD — scan every container image and YAML file before deployment
  2. kube-bench or Kubescape in-cluster — run scheduled compliance scans against running clusters

If you prefer a single tool, Kubescape covers the broadest range of Kubernetes security needs, while Trivy offers the best vulnerability detection across images, clusters, and infrastructure code.

FAQ

What is the difference between kube-bench and Kubescape?

kube-bench focuses exclusively on CIS Kubernetes Benchmark compliance checking. It provides detailed pass/fail results for 100+ individual CIS controls. Kubescape is a broader security platform that includes CIS benchmark checks plus MITRE ATT&CK mapping, NSA/CISA compliance, RBAC analysis, network policy auditing, and continuous monitoring capabilities. If you only need CIS compliance, kube-bench is simpler. If you want comprehensive Kubernetes security posture management, Kubescape is the better choice.

Can Trivy replace kube-hunter?

Yes. The kube-hunter project is no longer actively maintained, and Aqua Security (the same company behind both projects) officially recommends Trivy for Kubernetes vulnerability scanning. Trivy’s Kubernetes scanning mode detects known vulnerabilities in running workloads, checks cluster misconfigurations against multiple frameworks, and scans for exposed secrets — covering all the capabilities kube-hunter provided.

How often should I run container security scans?

Best practice is to scan at three points:

  • In CI/CD — scan every container image and Kubernetes YAML file before deployment (Trivy excels here)
  • Scheduled cluster scans — run kube-bench or Kubescape weekly against your running cluster to catch configuration drift
  • Continuous monitoring — deploy Kubescape as an operator or integrate Trivy with your monitoring stack for real-time alerts on new vulnerabilities

Do these tools work with managed Kubernetes (EKS, GKE, AKS)?

Yes. kube-bench has specific benchmark profiles for EKS, GKE, and AKS that skip controls not applicable to managed services. Trivy and Kubescape both work with any Kubernetes cluster accessible via kubectl, including managed services. Note that managed services restrict access to control plane components, so some checks (etcd configuration, API server flags) will be skipped automatically.

Can I integrate these tools into GitLab CI or GitHub Actions?

All three tools are distributed as single static binaries, making them easy to integrate into any CI/CD pipeline. Trivy also has official GitHub Actions and GitLab CI templates. For example, a GitHub Actions workflow with Trivy:

1
2
3
4
5
6
7
- name: Run Trivy vulnerability scanner
  uses: aquasecurity/trivy-action@master
  with:
    image-ref: ${{ github.repository }}:${{ github.sha }}
    format: 'sarif'
    output: 'trivy-results.sarif'
    severity: 'CRITICAL,HIGH'

What compliance frameworks do these tools support?

  • kube-bench: CIS Kubernetes Benchmark (versions 1.6 through 1.24, including managed service variants)
  • Trivy: CIS Kubernetes Benchmark, CIS Docker Benchmark, Pod Security Standards, NSA/CISA Kubernetes Hardening Guide
  • Kubescape: CIS Kubernetes Benchmark, MITRE ATT&CK for Kubernetes, NSA/CISA Kubernetes Hardening Guide, SOC2, ISO 27001, and custom organizational frameworks

JSON-LD Structured Data

For related reading, see our runtime security monitoring guide for detecting attacks on running containers, the IaC security scanning comparison for securing Terraform and Kubernetes manifests before deployment, and the vulnerability scanner guide for broader infrastructure vulnerability assessment.

Advertise here