kubernetes-security-policies
Kubernetes security policies, RBAC, and Pod Security Standards for hardened cluster deployments. Use when implementing cluster security, defining network policies, or enforcing security compliance in Kubernetes environments.
What this skill does
# Kubernetes Security Policies Comprehensive guidance for implementing security policies in Kubernetes clusters, covering Pod Security Standards, Network Policies, RBAC, Security Contexts, admission control, secrets management, and runtime security for production-grade hardened deployments. ## When to Use This Skill - Implementing Pod Security Standards (PSS/PSA) across namespaces - Designing and enforcing Network Policies for micro-segmentation - Configuring RBAC with least-privilege access control - Setting Security Contexts for container hardening - Deploying admission controllers (OPA/Gatekeeper, Kyverno) - Managing secrets and sensitive data securely - Implementing image security and vulnerability scanning - Enforcing runtime security policies and threat detection - Meeting compliance requirements (CIS, NIST, PCI-DSS, SOC2) - Conducting security audits and hardening assessments ## Core Security Concepts **Pod Security Standards (PSS):** Three progressive security levels enforced via Pod Security Admission (PSA): - **Privileged:** Unrestricted (default) - **Baseline:** Prevents known privilege escalations - **Restricted:** Pod hardening best practices (production recommended) **Network Policies:** Zero-trust micro-segmentation controlling pod-to-pod and pod-to-external traffic using label selectors and namespace isolation. **RBAC (Role-Based Access Control):** Least-privilege access control using ServiceAccounts, Roles, RoleBindings for namespace-scoped permissions, and ClusterRoles for cluster-wide access. **Security Contexts:** Container and pod-level security settings including user/group IDs, capabilities, seccomp profiles, and filesystem restrictions. **Admission Control:** Policy enforcement at API admission time using OPA Gatekeeper (Rego) or Kyverno (YAML) to validate, mutate, or reject resources. **Secrets Management:** External secret storage integration (Vault, AWS Secrets Manager, Sealed Secrets) instead of native Kubernetes secrets. **Image Security:** Vulnerability scanning, signature verification, digest-based immutability, and private registry authentication. ## Quick Reference | Task | Load reference | | --- | --- | | Pod Security Standards (PSS/PSA) | `skills/kubernetes-security-policies/references/pod-security-standards.md` | | Network Policies | `skills/kubernetes-security-policies/references/network-policies.md` | | RBAC (Roles, ServiceAccounts) | `skills/kubernetes-security-policies/references/rbac.md` | | Security Contexts (capabilities, seccomp) | `skills/kubernetes-security-policies/references/security-contexts.md` | | Admission Control (OPA, Kyverno) | `skills/kubernetes-security-policies/references/admission-control.md` | | Secrets Management (Vault, ESO) | `skills/kubernetes-security-policies/references/secrets-management.md` | | Image Security (scanning, signing) | `skills/kubernetes-security-policies/references/image-security.md` | | Best Practices & Compliance | `skills/kubernetes-security-policies/references/best-practices.md` | ## Security Implementation Workflow ### Phase 1: Baseline Assessment 1. Audit current security posture with kube-bench or kubescape 2. Identify gaps against CIS Kubernetes Benchmark 3. Document compliance requirements (PCI-DSS, NIST, SOC2) ### Phase 2: Pod Security Standards 1. Enable PSA audit mode on all namespaces 2. Identify violations using `kubectl get pods -A --show-labels` 3. Remediate workloads to meet baseline/restricted standards 4. Progressively enforce: dev (warn) → staging (baseline) → prod (restricted) ### Phase 3: Network Segmentation 1. Deploy default-deny NetworkPolicy to all namespaces 2. Create explicit allow rules for required traffic flows 3. Implement database isolation policies 4. Add monitoring/observability exceptions ### Phase 4: Access Control (RBAC) 1. Audit existing RBAC with `kubectl auth can-i --list` 2. Create dedicated ServiceAccounts per application 3. Define least-privilege Roles with specific resource/verb restrictions 4. Disable `automountServiceAccountToken` by default 5. Minimize ClusterRole usage ### Phase 5: Admission Control 1. Choose policy engine: OPA Gatekeeper (Rego) or Kyverno (YAML) 2. Implement validation policies: require labels, resource limits, non-root 3. Add mutation policies: inject security contexts, sidecar containers 4. Enforce image policies: disallow latest tag, require signatures ### Phase 6: Secrets Management 1. Deploy External Secrets Operator or Vault integration 2. Migrate native Secrets to external secret stores 3. Enable encryption at rest for etcd 4. Implement secret rotation policies ### Phase 7: Image Security 1. Integrate vulnerability scanning in CI/CD (Trivy, Snyk) 2. Implement image signing with Sigstore/Cosign 3. Enforce signature verification via admission control 4. Use immutable image digests instead of tags ### Phase 8: Runtime Security 1. Deploy Falco for runtime threat detection 2. Enable Kubernetes audit logging 3. Configure alerts for security events 4. Implement intrusion detection policies ## Common Mistakes **Pod Security:** - Running containers as root (always set `runAsNonRoot: true`) - Using privileged containers (avoid unless absolutely necessary) - Writable root filesystem (set `readOnlyRootFilesystem: true`) - Missing resource limits (required for restricted PSS) **Network Policies:** - No default-deny policy (unrestricted pod-to-pod traffic) - Overly permissive egress rules (allow all external traffic) - Forgetting DNS egress (pods can't resolve names) - Missing monitoring/observability exceptions **RBAC:** - Overly broad ClusterRole permissions (violates least privilege) - Sharing ServiceAccounts across applications - Using `*` verbs or resources in Roles - Not auditing RBAC permissions regularly **Secrets:** - Committing secrets to Git repositories - Using environment variables instead of mounted files - Relying on base64 encoding as encryption - No secret rotation policy **Admission Control:** - Enforcing policies without audit phase first - Blocking kube-system namespace accidentally - No policy testing in staging environment - Missing exemptions for system components **Images:** - Using `latest` tag (not immutable, breaks reproducibility) - No vulnerability scanning in CI/CD - Unsigned images in production - Large base images (use distroless or Alpine) ## Resources - **Pod Security Standards:** https://kubernetes.io/docs/concepts/security/pod-security-standards/ - **Network Policies:** https://kubernetes.io/docs/concepts/services-networking/network-policies/ - **RBAC:** https://kubernetes.io/docs/reference/access-authn-authz/rbac/ - **OPA Gatekeeper:** https://open-policy-agent.github.io/gatekeeper/ - **Kyverno:** https://kyverno.io/docs/ - **External Secrets Operator:** https://external-secrets.io/ - **Falco Runtime Security:** https://falco.org/docs/ - **CIS Benchmarks:** https://www.cisecurity.org/benchmark/kubernetes - **NSA/CISA Hardening Guide:** https://media.defense.gov/2022/Aug/29/2003066362/-1/-1/0/CTR_KUBERNETES_HARDENING_GUIDANCE_1.2_20220829.PDF
Related in Cloud & DevOps
appbuilder-action-scaffolder
IncludedCreate, implement, deploy, and debug Adobe Runtime actions with consistent layout, validation, and error handling. Use this skill whenever the user needs to add actions to an App Builder project, understand action structure (params, response format, web/raw actions), configure actions in the manifest, use App Builder SDKs (State, Files, Events, database), deploy and invoke actions via CLI, debug action issues, or implement patterns such as webhook receivers, custom event providers, journaling consumers, large payload redirects, action sequence pipelines, and Asset Compute workers. Also trigger when users mention serverless functions in Adobe context, action logging, IMS authentication for actions, or cron-style scheduled actions.
orchestrating-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. Use this skill when the user needs a multi-step Data Cloud pipeline, cross-phase troubleshooting, or data space and data kit management. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase sf data360 workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching phase-specific skill), the task is STDM/session tracing/parquet telemetry (use observing-agentforce), standard CRM SOQL (use querying-soql), or Apex implementation (use generating-apex).
github-project-automation
IncludedAutomate GitHub repository setup with CI/CD workflows, issue templates, Dependabot, and CodeQL security scanning. Includes 12 production-tested workflows and prevents 18 errors: YAML syntax, action pinning, and configuration. Use when: setting up GitHub Actions CI/CD, creating issue/PR templates, enabling Dependabot or CodeQL scanning, deploying to Cloudflare Workers, implementing matrix testing, or troubleshooting YAML indentation, action version pinning, secrets syntax, runner versions, or CodeQL configuration. Keywords: github actions, github workflow, ci/cd, issue templates, pull request templates, dependabot, codeql, security scanning, yaml syntax, github automation, repository setup, workflow templates, github actions matrix, secrets management, branch protection, codeowners, github projects, continuous integration, continuous deployment, workflow syntax error, action version pinning, runner version, github context, yaml indentation error
sf-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase `sf data360` workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching sf-datacloud-* skill), the task is STDM/session tracing/parquet telemetry (use sf-ai-agentforce-observability), standard CRM SOQL (use sf-soql), or Apex implementation (use sf-apex).
fabric-cli
IncludedUse this skill for Fabric.so CLI workflows with the `fabric` terminal command: diagnose/install/login, search or browse a Fabric library, save notes/links/files, create folders, ask the Fabric AI assistant, manage tasks/workspaces, generate shell completion, check subscription usage, produce JSON output, and use Fabric as persistent agent memory. Do not use for Microsoft Fabric/Azure/Power BI `fab`, Daniel Miessler's Fabric framework, Python Fabric SSH, Fabric.js, or textile/fashion fabric.
lark
IncludedLark/Feishu CLI skills: lark-cli operations for docs, markdown, sheets, base, calendar, im, mail, task, okr, drive, wiki, slides, whiteboard, apps, approval, attendance, contact, vc, minutes, event. Use when the user needs to operate Lark/Feishu resources via lark-cli, send messages, manage documents, spreadsheets, calendars, tasks, OKRs, deploy web pages, or any Feishu/Lark workspace operations.