<< All versions

Skill v1.0.1

currentAutomated scan96/100
rohitg00/kubectl-mcp-server/k8s-security

6 files

──Details
PublishedOctober 25, 2026 at 07:18 PM
Content Hashsha256:11b63abe7f10d0fa...
Git SHAa3fef9fe2310
Bump Typepatch
Compare with v1.0.0
──Files
Files (1 file, 5.0 KB)
SKILL.md5.0 KBactive
SKILL.md · 196 lines · 5.0 KB

version: "1.0.1" name: k8s-security description: Audit Kubernetes RBAC, enforce policies, and manage secrets. Use for security reviews, permission audits, policy enforcement with Kyverno/Gatekeeper, and secret management. license: MIT-0 metadata: author: rohitg00 version: "2.0.0" tools: 10 category: security


Kubernetes Security

Security auditing, RBAC management, and policy enforcement using kubectl-mcp-server tools.

Requires the cilium, istio, policy, security toolsets: start kubectl-mcp-server with --toolsets default,cilium,istio,policy,security (or MCP_TOOLSETS=default,cilium,istio,policy,security). For deep work, the project-maintained MCP servers may fit better: Kyverno: https://github.com/nirmata/kyverno-mcp.

When to Apply

Use this skill when:

  • User mentions: "security", "RBAC", "permissions", "policy", "audit", "secrets"
  • Operations: security review, permission check, policy enforcement
  • Keywords: "who can", "access control", "compliance", "vulnerable"

Priority Rules

PriorityRuleImpactTools
1Check cluster-admin bindings firstCRITICALkubectl_get
2Audit secrets access permissionsCRITICALReview role rules
3Verify network isolationHIGHanalyze_network_policies
4Check policy complianceHIGHkyverno_*, gatekeeper_*
5Review pod security contextsMEDIUMkubectl_describe

Quick Reference

TaskToolExample
List roleskubectl_getkubectl_get(resource_type="roles", namespace)
Cluster roleskubectl_getkubectl_get(resource_type="clusterroles")
Role bindingskubectl_getkubectl_get(resource_type="roles", namespace)
Service accountskubectl_getkubectl_get(resource_type="serviceaccounts", namespace)
Kyverno policiesget_policy_listget_policy_list()

RBAC Auditing

List Roles and Bindings

python
kubectl_get(resource_type="roles", namespace)
kubectl_get(resource_type="clusterroles")
kubectl_get(resource_type="roles", namespace)
kubectl_get(resource_type="clusterroles")

Check Service Account Permissions

python
kubectl_get(resource_type="serviceaccounts", namespace)

Common RBAC Patterns

PatternRisk LevelCheck
cluster-admin bindingCriticalkubectl_get(resource_type="clusterroles")
Wildcard verbs (*)HighReview role rules
secrets accessHighCheck get/list on secrets
pod/execHighAllows container access

See RBAC-PATTERNS.md for detailed patterns and remediation.

Policy Enforcement

Kyverno Policies

python
get_policy_list(namespace)
get_policy_list()
get_policy(name, namespace)

OPA Gatekeeper

python
get_policy_list()
get_policy(kind, name)
get_policy_list()

Common Policies to Enforce

PolicyPurpose
Disallow privilegedPrevent root containers
Require resource limitsPrevent resource exhaustion
Restrict host namespacesIsolate from node
Require labelsEnsure metadata
Allowed registriesControl image sources

Secret Management

List Secrets

python
kubectl_get(resource_type="secrets", namespace)

Secret Best Practices

  1. Use external secret managers (Vault, AWS SM)
  2. Encrypt secrets at rest (EncryptionConfiguration)
  3. Limit secret access via RBAC
  4. Rotate secrets regularly

Network Policies

List Policies

python
analyze_network_policies(namespace)

Cilium Network Policies

python
cilium_list_policies(namespace)
cilium_get_policy(name, namespace)

Default Deny Template

yaml
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: default-deny-all
spec:
podSelector: {}
policyTypes:
- Ingress
- Egress

Security Scanning Workflow

  1. RBAC Audit

``python kubectl_get(resource_type="clusterroles") kubectl_get(resource_type="roles", namespace) ``

  1. Policy Compliance

``python get_policy_list() get_policy_list() ``

  1. Network Isolation

``python analyze_network_policies(namespace) cilium_list_endpoints(namespace) ``

  1. Pod Security

``python kubectl_get(resource_type="pods", namespace) kubectl_describe(name, namespace) ``

Multi-Cluster Security

Audit across clusters:

python
kubectl_get(resource_type="clusterroles", context="production")
kubectl_get(resource_type="clusterroles", context="staging")

Automated Audit Script

For comprehensive security audit, see scripts/audit-rbac.py.

Related Tools

  • RBAC: kubectl_get, kubectl_get, kubectl_get
  • Policy: kyverno_*, gatekeeper_*
  • Network: analyze_network_policies, cilium_policies_*
  • Istio: istio_authorizationpolicies_list, istio_peerauthentications_list

Related Skills

← v1.0.0All versions