kubernetes-skills/claude/k8s-security/SKILL.md
Audit Kubernetes RBAC, enforce policies, and manage secrets. Use for security reviews, permission audits, policy enforcement with Kyverno/Gatekeeper, and secret management.
npx skillsauth add rohitg00/kubectl-mcp-server k8s-securityInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Security auditing, RBAC management, and policy enforcement using kubectl-mcp-server tools.
Use this skill when:
| Priority | Rule | Impact | Tools |
|----------|------|--------|-------|
| 1 | Check cluster-admin bindings first | CRITICAL | get_cluster_role_bindings |
| 2 | Audit secrets access permissions | CRITICAL | Review role rules |
| 3 | Verify network isolation | HIGH | get_network_policies |
| 4 | Check policy compliance | HIGH | kyverno_*, gatekeeper_* |
| 5 | Review pod security contexts | MEDIUM | describe_pod |
| Task | Tool | Example |
|------|------|---------|
| List roles | get_roles | get_roles(namespace) |
| Cluster roles | get_cluster_roles | get_cluster_roles() |
| Role bindings | get_role_bindings | get_role_bindings(namespace) |
| Service accounts | get_service_accounts | get_service_accounts(namespace) |
| Kyverno policies | kyverno_clusterpolicies_list_tool | kyverno_clusterpolicies_list_tool() |
get_roles(namespace)
get_cluster_roles()
get_role_bindings(namespace)
get_cluster_role_bindings()
get_service_accounts(namespace)
| Pattern | Risk Level | Check |
|---------|-----------|-------|
| cluster-admin binding | Critical | get_cluster_role_bindings() |
| Wildcard verbs (*) | High | Review role rules |
| secrets access | High | Check get/list on secrets |
| pod/exec | High | Allows container access |
See RBAC-PATTERNS.md for detailed patterns and remediation.
kyverno_policies_list_tool(namespace)
kyverno_clusterpolicies_list_tool()
kyverno_policy_get_tool(name, namespace)
gatekeeper_constraints_list_tool()
gatekeeper_constraint_get_tool(kind, name)
gatekeeper_templates_list_tool()
| Policy | Purpose | |--------|---------| | Disallow privileged | Prevent root containers | | Require resource limits | Prevent resource exhaustion | | Restrict host namespaces | Isolate from node | | Require labels | Ensure metadata | | Allowed registries | Control image sources |
get_secrets(namespace)
get_network_policies(namespace)
cilium_policies_list_tool(namespace)
cilium_policy_get_tool(name, namespace)
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: default-deny-all
spec:
podSelector: {}
policyTypes:
- Ingress
- Egress
RBAC Audit
get_cluster_role_bindings()
get_roles(namespace)
Policy Compliance
kyverno_clusterpolicies_list_tool()
gatekeeper_constraints_list_tool()
Network Isolation
get_network_policies(namespace)
cilium_endpoints_list_tool(namespace)
Pod Security
get_pods(namespace)
describe_pod(name, namespace)
Audit across clusters:
get_cluster_role_bindings(context="production")
get_cluster_role_bindings(context="staging")
For comprehensive security audit, see scripts/audit-rbac.py.
get_roles, get_cluster_roles, get_role_bindingskyverno_*, gatekeeper_*get_network_policies, cilium_policies_*istio_authorizationpolicies_list_tool, istio_peerauthentications_list_tooldevelopment
Manage vCluster (virtual Kubernetes clusters) instances using vind. Use when creating, managing, or operating lightweight virtual clusters for development, testing, or multi-tenancy.
development
Debug Kubernetes pods, nodes, and workloads. Use when pods are failing, containers crash, nodes are unhealthy, or users mention debugging, troubleshooting, or diagnosing Kubernetes issues.
devops
Kubernetes storage management for PVCs, storage classes, and persistent volumes. Use when provisioning storage, managing volumes, or troubleshooting storage issues.
testing
Manage Istio service mesh for traffic management, security, and observability. Use for traffic shifting, canary releases, mTLS, and service mesh troubleshooting.