defending-kubernetes

defending-kubernetes is a skill for Claude Code from trilwu/secskills. It costs 98 tokens per session (2,067 once invoked), scanned A, original, MIT.

A guide to securing Kubernetes, a system for running and managing containers across computers. It focuses on access permissions, workload restrictions, network separation, secrets, service accounts, and cluster activity logs.

In plain words
What is it for?
Reviewing cluster security, hardening access and workload settings, responding after a suspected compromise, protecting the control plane and kubelet, and turning attack findings into security controls.
Why use it?
Kubernetes can expose a whole cluster when permissions are too broad, containers run with excessive privileges, or internal networks and credentials are left open. This helps identify what to enforce and what to monitor.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the secskills-defense plugin — 22 skills shipped together

Good fit Reviewing cluster security, hardening access and workload settings, responding after a suspected compromise, protecting the control plane and kubelet, and turning attack findings into security controls.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/trilwu/secskills/defending-kubernetes
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add trilwu/secskills --skill defending-kubernetes
Clone the repo
git clone --depth 1 https://github.com/trilwu/secskills

Made for: Claude Code.

Or install secskills-defense, the plugin that ships this one along with the rest of its 22 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for defending-kubernetes

README.md
[![agentmods](https://agentmods.dev/badge/skills/trilwu/secskills/defending-kubernetes/github.svg)](https://agentmods.dev/skills/trilwu/secskills/defending-kubernetes)
Your own site
<a href="https://agentmods.dev/skills/trilwu/secskills/defending-kubernetes"><img src="https://agentmods.dev/badge/skills/trilwu/secskills/defending-kubernetes/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for defending-kubernetes

Your own site · 80×15
<a href="https://agentmods.dev/skills/trilwu/secskills/defending-kubernetes"><img src="https://agentmods.dev/badge/skills/trilwu/secskills/defending-kubernetes.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 98 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,067 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Tool Misuse · line 79
    Code deploys a privileged Kubernetes workload (privileged container, hostPath mount, or host namespaces). This grants root on the node and is a node/cluster takeover vector.
    Fix: Remove privileged, hostPath, and host-namespace settings from workloads. Use a least-privilege securityContext, drop capabilities, and avoid mounting the host filesystem.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00098 $0.02067
Opus 5 $0.00049 $0.01033
Sonnet 5 $0.00020 $0.00413
Haiku 4.5 $0.00010 $0.00207

Measured 11d ago against content hash acfe29f17e02, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

defending-kubernetes scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -sL "https://defuddle.md/<url>" # scheme in the path is optional
secskills-defense/skills/defending-kubernetes/SKILL.md · 185 lines

How it starts

The opening of the file, as written. The whole thing — 185 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Defending Kubernetes

Kubernetes is insecure in useful defaults, not in exotic bugs. The attacks that land are RBAC that grants more than intended, pods that run privileged because nothing stops them, a flat pod network, and mounted service-account tokens with cluster-wide reach. Defense is mostly closing those, in priority order, and being able to see when someone tries.

This is the counterpart to attacking-eks-gke-aks and exploiting-containers: read those to know what the attacker does; use this to know what to enforce and what to watch.

When to Use

  • Reviewing a cluster's security posture or an admission/RBAC configuration
  • Responding to a suspected cluster compromise (post-triage)
  • Deciding what to enforce (Pod Security, network policy) and what to detect
  • Translating an offensive cluster finding into a concrete control
  • Hardening the control plane, kubelet, or etcd exposure

When NOT to Use

  • Attacking the cluster — use attacking-eks-gke-aks
  • Container escape and runtime internals specifically — use exploiting-containers / escaping-hardened-containers for the technique; return here for the control
  • The cloud IAM plane around the cluster (IRSA, workload identity, node role) — that is investigating-*-incidents / hardening-cloud-posture; a GKE/EKS/AKS incident usually needs both planes
  • Whether an alert is an incident — use triaging-security-alerts

Enforce in Priority Order

Order matters — these are ranked by how often the gap is the actual entry path.

1. RBAC least privilege

The most common real weakness. Look for the bindings that are escalation primitives regardless of how innocent they look:

# Who can create pods anywhere? (→ mount any secret, run as any SA)
kubectl auth can-i create pods --all-namespaces --as=system:serviceaccount:ns:sa

# Subjects bound to cluster-admin
kubectl get clusterrolebindings -o json | \
  jq '.items[] | select(.roleRef.name=="cluster-admin") | .subjects'

Read the full file on GitHub · 185 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 185 lines · 98 tokens per session scan A acfe29f17e02

Subscribe to this mod's changes

defending-kubernetes is a skill published in the GitHub repository trilwu/secskills (138 stars, last pushed 6d ago), licensed MIT. It adds 98 tokens to every session and 2,067 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

build-mcpb

This skill should be used when the user wants to "package an MCP server", "bundle an MCP", "make an MCPB", "ship a local MCP server", "distribute a local MCP", discusses ".mcpb files", mentions bundling a Node or Python runtime with their MCP server, or needs an MCP server that interacts with the local filesystem…

anthropics/claude-plugins-official · 98 tokens

gke-app-onboarding

Manages GKE application onboarding, covering containerization, deployment manifests, and migration. Use when onboarding or deploying an application to GKE for the first time, or containerizing an app for GKE. Don't use for general GKE cluster administration or upgrades (use gke-basics or gke-upgrades instead).

google/skills · 70 tokens

offensive-container-escape

Container escape and breakout techniques targeting Docker, containerd, and Podman runtimes. Covers privileged container breakout via host filesystem mount and nsenter, Docker socket abuse through /var/run/docker.sock, Linux capability exploitation including CAPSYSADMIN, CAPSYSPTRACE, and CAPNETADMIN, cgroup v1…

SnailSploit/Claude-Red · 196 tokens

wrangler

Run or troubleshoot Wrangler CLI commands and configure Worker projects for local development, deployment, and Cloudflare resource management.

cloudflare/skills · 25 tokens

managing-astro-local-env

Manage local Airflow environment with Astro CLI (Docker and standalone modes). Use when the user wants to start, stop, or restart Airflow, view logs, query the Airflow API, troubleshoot, or fix environment issues. For project setup, see setting-up-astro-project.

astronomer/agents · 63 tokens

kubernetes-patterns

Pods, deployments, services, ingress, RBAC, autoscaling, and production cluster best practices.

cosmicstack-labs/mercury-agent-skills · 24 tokens