k8s-security-policies

Implement Kubernetes security policies for network isolation and pod security standards.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/leochanai/leo-obsidian-main --skill k8s-security-policies-leochanai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: k8s-security-policies
Source: https://github.com/leochanai/leo-obsidian-main/tree/main/13 Skills/k8s-security-policies
Command: npx skills add https://github.com/leochanai/leo-obsidian-main --skill k8s-security-policies-leochanai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes assets (resource) and references (resource) components.

What problem does it solve?

Comprehensive guide for implementing Kubernetes security policies including NetworkPolicy, PodSecurityPolicy, and RBAC for production-grade security.

Core Features & Use Cases

  • Pod Security Standards: Privileged, Baseline, and Restricted namespace configurations with YAML examples.
  • Network Policies: Default deny, allow frontend-to-backend, and DNS allow templates.
  • RBAC Configuration: Namespaced Roles, ClusterRoles, and bindings patterns for least-privilege access.
  • Policy Enforcement: OPA/Gatekeeper/ Kyverno examples and integration guidance.
  • Best Practices & Compliance: Alignment with CIS Kubernetes Benchmark and NIST-like defense-in-depth.

Quick Start

Apply the provided security templates (network policies, pod security standards, and RBAC patterns) to your cluster to establish a hardened baseline.

Frequently Asked Questions about k8s-security-policies

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce network isolation in Kubernetes clusters?

Network isolation in Kubernetes uses NetworkPolicy resources to control traffic between pods. Default-deny policies block all ingress, then you explicitly allow required frontend-to-backend communication and DNS queries, hardening your cluster against lateral movement and unauthorized access.

What are Kubernetes pod security standards and how do I implement them?

Pod security standards define three levels—Privileged, Baseline, and Restricted—that govern container capabilities, privilege escalation, and filesystem access. Apply them at the namespace level via labels to enforce consistent security posture across your workloads.

How do I set up least-privilege RBAC in Kubernetes?

Least-privilege RBAC uses Roles and ClusterRoles paired with RoleBindings to grant only the minimum permissions required. Define granular rules scoped to specific namespaces or cluster-wide, then bind them to service accounts to prevent privilege escalation.

Can I use policy enforcement tools like OPA Gatekeeper or Kyverno with Kubernetes?

Yes. OPA Gatekeeper and Kyverno enforce admission control policies by validating or mutating resources before they're persisted. Both integrate with Kubernetes webhooks and support CIS Benchmark compliance and multi-tenant security requirements.

Do I need RBAC configured before applying network policies?

RBAC and NetworkPolicy serve different functions and can be implemented independently, but combining both follows defense-in-depth principles. RBAC controls API access and actions; NetworkPolicy controls runtime pod-to-pod communication.

What's the best way to audit Kubernetes security policy compliance?

Audit compliance by reviewing applied policies against CIS Kubernetes Benchmark and NIST defense-in-depth standards. Use policy enforcement tools to log policy violations and track which pods and namespaces violate restricted pod security standards or network policies.