scanning-kubernetes-manifests-with-kubesec

mukul975/Anthropic-Cybersecurity-Skills · updated May 25, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills install mukul975/Anthropic-Cybersecurity-Skills/scanning-kubernetes-manifests-with-kubesec
0 commentsdiscussion
summary

Perform security risk analysis on Kubernetes resource manifests using Kubesec to identify misconfigurations, privilege escalation risks, and deviations from security best practices.

skill.md
name
scanning-kubernetes-manifests-with-kubesec
description
Perform security risk analysis on Kubernetes resource manifests using Kubesec to identify misconfigurations, privilege escalation risks, and deviations from security best practices.
domain
cybersecurity
subdomain
container-security
tags
- kubesec - kubernetes - manifest-scanning - security-scanning - devsecops - misconfiguration - static-analysis - ci-cd
version
'1.0'
author
mahipal
license
Apache-2.0
nist_csf
- PR.PS-01 - PR.IR-01 - ID.AM-08 - DE.CM-01

Scanning Kubernetes Manifests with Kubesec

Overview

Kubesec is an open-source security risk analysis tool developed by ControlPlane that inspects Kubernetes resource manifests for common exploitable risks such as privilege escalation, writable host mounts, and excessive capabilities. It assigns a numerical security score to each resource and provides actionable recommendations for hardening. Kubesec can be used as a CLI binary, Docker container, kubectl plugin, admission webhook, or REST API endpoint.

When to Use

  • When conducting security assessments that involve scanning kubernetes manifests with kubesec
  • When following incident response procedures for related security events
  • When performing scheduled security testing or auditing activities
  • When validating security controls through hands-on testing

Prerequisites

  • Kubernetes manifest files (YAML/JSON) for Deployments, Pods, DaemonSets, StatefulSets
  • Docker or Go runtime for local installation
  • kubectl access for scanning live cluster resources
  • CI/CD pipeline access for automated scanning integration

Core Concepts

Security Scoring System

Kubesec assigns a score to each Kubernetes resource based on security checks:

  • Positive scores: Awarded for security-enhancing configurations (readOnlyRootFilesystem, runAsNonRoot)
  • Zero or negative scores: Indicate missing security controls or dangerous configurations
  • Critical advisories: Flagged configurations that represent immediate security risks

Check Categories

  1. Privilege Controls: Checks for privileged containers, host PID/network access, root execution
  2. Capabilities: Identifies excessive Linux capabilities (SYS_ADMIN, NET_RAW)
  3. Volume Mounts: Detects dangerous host path mounts and writable sensitive paths
  4. Resource Limits: Validates presence of CPU/memory resource constraints
  5. Security Context: Verifies seccomp profiles, AppArmor annotations, SELinux contexts

Installation

Binary Installation

# Linux/macOS
curl -sSL https://github.com/controlplaneio/kubesec/releases/latest/download/kubesec_linux_amd64.tar.gz | \
  tar xz -C /usr/local/bin/ kubesec

# Verify installation
kubesec version

Docker Installation

docker pull kubesec/kubesec:v2

# Scan a manifest file
docker run -i kubesec/kubesec:v2 scan /dev/stdin < deployment.yaml

kubectl Plugin

kubectl krew install kubesec-scan
kubectl kubesec-scan pod mypod -n default

Practical Scanning

Scanning a Single Manifest

# Scan a deployment manifest
kubesec scan deployment.yaml

# Scan with JSON output
kubesec scan -o json deployment.yaml

# Scan from stdin
cat pod.yaml | kubesec scan -

Sample Output

[
  {
    "object": "Pod/web-app.default",
    "valid": true,
    "fileName": "pod.yaml",
    "message": "Passed with a score of 3 points",
    "score": 3,
    "scoring": {
      "passed": [
        {
          "id": "ReadOnlyRootFilesystem",
          "selector": "containers[] .securityContext .readOnlyRootFilesystem == true",
          "reason": "An immutable root filesystem prevents applications from writing to their local disk",
          "points": 1
        },
        {
          "id": "RunAsNonRoot",
          "selector": "containers[] .securityContext .runAsNonRoot == true",
          "reason": "Force the running image to run as a non-root user",
          "points": 1
        },
        {
          "id": "LimitsCPU",
          "selector": "containers[] .resources .limits .cpu",
          "reason": "Enforcing CPU limits prevents DOS via resource exhaustion",
          "points": 1
        }
      ],
      "advise": [
        {
          "id": "ApparmorAny",
          "selector": "metadata .annotations .\"container.apparmor.security.beta.kubernetes.io/nginx\"",
          "reason": "Well defined AppArmor policies reduce the attack surface of the container",
          "points": 3
        },
        {
          "id": "ServiceAccountName",
          "selector": ".spec .serviceAccountName",
          "reason": "Service accounts restrict Kubernetes API access and should be configured",
          "points": 3
        }
      ]
    }
  }
]

Scanning Multiple Resources

# Scan all YAML files in a directory
for file in manifests/*.yaml; do
  echo "=== Scanning $file ==="
  kubesec scan "$file"
done

# Scan multi-document YAML
kubesec scan multi-resource.yaml

Using the HTTP API

# Scan via the public API
curl -sSX POST --data-binary @deployment.yaml \
  https://v2.kubesec.io/scan

# Run a local API server
kubesec http --port 8080 &

# Scan against local server
curl -sSX POST --data-binary @deployment.yaml \
  http://localhost:8080/scan

CI/CD Integration

GitHub Actions

name: Kubesec Scan
on: [pull_request]
jobs:
  kubesec:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install Kubesec
        run: |
          curl -sSL https://github.com/controlplaneio/kubesec/releases/latest/download/kubesec_linux_amd64.tar.gz | \
            tar xz -C /usr/local/bin/ kubesec
      - name: Scan Manifests
        run: |
          FAIL=0
          for file in k8s/*.yaml; do
            SCORE=$(kubesec scan "$file" | jq '.[0].score')
            echo "$file: score=$SCORE"
            if [ "$SCORE" -lt 0 ]; then
              echo "FAIL: $file has critical issues (score: $SCORE)"
              FAIL=1
            fi
          done
          exit $FAIL

GitLab CI

kubesec-scan:
  stage: security
  image: kubesec/kubesec:v2
  script:
    - |
      for file in k8s/*.yaml; do
        kubesec scan "$file" > /tmp/result.json
        SCORE=$(cat /tmp/result.json | jq '.[0].score')
        if [ "$SCORE" -lt 0 ]; then
          echo "CRITICAL: $file scored $SCORE"
          cat /tmp/result.json | jq '.[0].scoring.critical'
          exit 1
        fi
      done
  artifacts:
    paths:
      - kubesec-results/

Admission Webhook

Deploy Kubesec as a ValidatingWebhookConfiguration to reject insecure manifests at deploy time:

apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
  name: kubesec-webhook
webhooks:
  - name: kubesec.controlplane.io
    rules:
      - apiGroups: [""]
        apiVersions: ["v1"]
        operations: ["CREATE", "UPDATE"]
        resources: ["pods"]
      - apiGroups: ["apps"]
        apiVersions: ["v1"]
        operations: ["CREATE", "UPDATE"]
        resources: ["deployments", "daemonsets", "statefulsets"]
    clientConfig:
      service:
        name: kubesec-webhook
        namespace: kube-system
        path: /scan
    failurePolicy: Fail
    sideEffects: None
    admissionReviewVersions: ["v1"]

Security Checks Reference

Critical Checks (Negative Score)

CheckSelectorRisk
PrivilegedsecurityContext.privileged == trueFull host access
HostPIDspec.hostPID == trueProcess namespace escape
HostNetworkspec.hostNetwork == trueNetwork namespace escape
SYS_ADMINcapabilities.add contains SYS_ADMINNear-root capability

Best Practice Checks (Positive Score)

CheckPointsDescription
ReadOnlyRootFilesystem+1Prevents filesystem writes
RunAsNonRoot+1Non-root process execution
RunAsUser > 10000+1High UID reduces collision risk
LimitsCPU+1Prevents CPU resource exhaustion
LimitsMemory+1Prevents memory resource exhaustion
RequestsCPU+1Ensures scheduler resource awareness
ServiceAccountName+3Explicit service account
AppArmor annotation+3Kernel-level MAC enforcement
Seccomp profile+4Syscall filtering

References

how to use scanning-kubernetes-manifests-with-kubesec

How to use scanning-kubernetes-manifests-with-kubesec on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add scanning-kubernetes-manifests-with-kubesec
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills install mukul975/Anthropic-Cybersecurity-Skills/scanning-kubernetes-manifests-with-kubesec

The skills CLI fetches scanning-kubernetes-manifests-with-kubesec from GitHub repository mukul975/Anthropic-Cybersecurity-Skills and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/scanning-kubernetes-manifests-with-kubesec

Reload or restart Cursor to activate scanning-kubernetes-manifests-with-kubesec. Access the skill through slash commands (e.g., /scanning-kubernetes-manifests-with-kubesec) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

Task Automation & Efficiency

Automate repetitive workflows and reduce manual effort

Example

Generate reports, summarize documents, draft communications

Save 3-5 hours per week on routine tasks

Knowledge Enhancement

Learn new skills, understand complex topics, get expert guidance

Example

Explain concepts, provide examples, suggest learning resources

Accelerate learning and skill development by 2x

Quality Improvement

Enhance output quality through reviews, suggestions, and refinements

Example

Review drafts, suggest improvements, catch errors

Improve work quality by 30-40% with less effort

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client with skill support
  • Clear understanding of task or problem to solve
  • Willingness to iterate and refine outputs

Time Estimate

15-45 minutes depending on use case complexity

Installation Steps

  1. 1.Install skill using provided installation command
  2. 2.Test with simple use case relevant to your work
  3. 3.Evaluate output quality and relevance
  4. 4.Iterate on prompts to improve results
  5. 5.Integrate into regular workflow if valuable

Common Pitfalls

  • Expecting perfect results without iteration
  • Not providing enough context in prompts
  • Using skill for tasks outside its intended scope
  • Accepting outputs without review and validation

Best Practices

✓ Do

  • +Start with clear, specific prompts
  • +Provide relevant context and constraints
  • +Review and refine all outputs before using
  • +Iterate to improve output quality
  • +Document successful prompt patterns

✗ Don't

  • Don't use without understanding skill limitations
  • Don't skip validation of outputs
  • Don't share sensitive information in prompts
  • Don't expect skill to replace human judgment

💡 Pro Tips

  • Be specific about desired format and style
  • Ask for multiple options to choose from
  • Request explanations to understand reasoning
  • Combine AI efficiency with human expertise

When to Use This

✓ Use When

Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.

✗ Avoid When

Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.

Learning Path

  1. 1Familiarize yourself with skill capabilities and limitations
  2. 2Start with low-risk, non-critical tasks
  3. 3Progress to more complex and valuable use cases
  4. 4Build expertise through regular use and experimentation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.764 reviews
  • Dhruvi Jain· Dec 28, 2024

    Registry listing for scanning-kubernetes-manifests-with-kubesec matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Luis Brown· Dec 24, 2024

    Useful defaults in scanning-kubernetes-manifests-with-kubesec — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Tariq Smith· Dec 24, 2024

    scanning-kubernetes-manifests-with-kubesec is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Sakura Desai· Dec 16, 2024

    We added scanning-kubernetes-manifests-with-kubesec from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Luis Taylor· Dec 4, 2024

    scanning-kubernetes-manifests-with-kubesec reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Luis Liu· Nov 23, 2024

    Registry listing for scanning-kubernetes-manifests-with-kubesec matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Oshnikdeep· Nov 19, 2024

    scanning-kubernetes-manifests-with-kubesec reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Sakura Gill· Nov 15, 2024

    Solid pick for teams standardizing on skills: scanning-kubernetes-manifests-with-kubesec is focused, and the summary matches what you get after install.

  • Valentina Huang· Nov 15, 2024

    scanning-kubernetes-manifests-with-kubesec has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Hiroshi Patel· Nov 15, 2024

    Keeps context tight: scanning-kubernetes-manifests-with-kubesec is the kind of skill you can hand to a new teammate without a long onboarding doc.

showing 1-10 of 64

1 / 7