К основному содержанию
скилл CX Codex

kubernetes-security-policies — скилл для Claude Code: безопасность k8s

Скилл kubernetes-security-policies для Claude Code помогает настроить Pod Security Standards, сетевые политики и RBAC в Kubernetes. Ужесточает защиту прод-окружения.

MIT 104 установок ★ 71 обновлён 2026-06-29

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add NickCrew/Claude-Cortex --skill kubernetes-security-policies -a claude-code
Открыть на GitHub

Что делает kubernetes-security-policies

Скилл раскладывает работу по фазам: аудит текущей защиты, затем Pod Security Standards, сегментация сети, RBAC, admission control, секреты, образы, runtime. На каждом шаге агент получает конкретные команды вроде kubectl auth can-i --list и разбор типичных ошибок — контейнеры под root, writable root filesystem, * в правилах Role.

Внутри один SKILL.md и папка skills/kubernetes-security-policies/references/ с отдельными файлами по темам: pod-security-standards.md, network-policies.md, rbac.md, security-contexts.md, admission-control.md, secrets-management.md, image-security.md, best-practices.md. Агент подхватывает скилл на манифестах вида **/k8s/**, **/helm/**, **/*deployment*.yaml.

Часть фаз опирается на внешние утилиты: kube-bench или kubescape для аудита, Trivy или Snyk для сканирования образов, Cosign для подписей, Falco для runtime. Без egress-правила для DNS поды в namespace с запретом по умолчанию перестанут резолвить имена, поэтому DNS-исключение добавляют сразу.

Какие задачи решает

  • включить Pod Security Admission в namespace и разобрать нарушения
  • закрыть трафик между подами через default-deny NetworkPolicy
  • урезать права ServiceAccount до нужных глаголов и ресурсов
  • выбрать между OPA Gatekeeper и Kyverno для проверки манифестов
  • убрать секреты из Git и перевести их на внешнее хранилище

Примеры запросов агенту

  • Проверь манифесты в k8s/ на соответствие restricted Pod Security Standard и покажи, что править.
  • Собери сетевые политики для namespace payments: сначала запретить всё, потом открыть только нужные потоки.
  • Опиши роли RBAC для сервиса orders так, чтобы у ServiceAccount были только необходимые права.

Как установить kubernetes-security-policies

1Через Skills CLI (Vercel)

npx skills add NickCrew/Claude-Cortex --skill kubernetes-security-policies -a claude-code

2Вручную: положить файлы

~/.claude/skills/kubernetes-security-policies/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/kubernetes-security-policies/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о kubernetes-security-policies

Как установить kubernetes-security-policies в Claude Code?

Выполните npx skills add NickCrew/Claude-Cortex --skill kubernetes-security-policies -a claude-code. Файл скилла появится по пути ~/.claude/skills/kubernetes-security-policies/SKILL.md.

Что делает kubernetes-security-policies?

Помогает агенту ужесточить кластер: Pod Security Standards, сетевые политики, RBAC, security context, admission control, секреты и образы.

Какие инструменты нужны для работы скилла?

Аудит опирается на kube-bench или kubescape, сканирование образов — на Trivy или Snyk, подписи — на Cosign, runtime-детект — на Falco. Политики описываются в OPA Gatekeeper или Kyverno.

Исходный текст

SKILL.md · MIT
---
name: kubernetes-security-policies
description: 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.
keywords:
  - OPA
  - RBAC
  - admission controller
  - container security
  - k8s security
  - kubernetes security
  - network policy
  - pod security
  - policy enforcement
  - security context
file_patterns:
  - '**/*deployment*.yaml'
  - '**/charts/**'
  - '**/helm/**'
  - '**/k8s/**'
  - '**/kubernetes/**'
confidence: 0.84
---

# 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

© NickCrew · MIT · NickCrew/Claude-Cortex

Похожие скиллы

Все скиллы по теме «DevOps и инфраструктура» →
analyzing-kubernetes-audit-logs mahipal Скилл analyzing-kubernetes-audit-logs разбирает audit-логи kube-apiserver в формате JSON lines и находит exec в под, чтение секретов, правки RBAC и анонимный доступ. CX Codex +1 471установок k8s-security-policies Seth Hobson Скилл k8s-security-policies помогает задавать политики безопасности Kubernetes: сетевую изоляцию, RBAC и стандарты безопасности подов. Нужен при защите кластера. CX Codex +1 14 692установок kubernetes-security-audit securityskills Скилл kubernetes-security-audit проверяет настройки Kubernetes-кластера на риски в правах доступа, подах, сетевых политиках и цепочке поставок. Пригодится при разборе конфигурации и укреплении защиты. CX Codex +1 244установок kubernetes-specialist https://github.com/Jeffallan Скилл kubernetes-specialist для Claude Code создаёт и проверяет Kubernetes-манифесты, настраивает безопасность и разбирает сбои подов. Помогает деплоить и сопровождать кластерные нагрузки. CX Codex +1 14 900установок kubernetes-pentesting yaklang Скилл kubernetes-pentesting для Claude Code содержит плейбук по пентесту Kubernetes: проверка доступа к API-серверу, RBAC, токенов service account, etcd, Kubelet API и побега из пода. CX Codex +1 4 100установок kubernetes-hardening devops-skills Скилл kubernetes-hardening помогает перевести манифесты Kubernetes на безопасные стандарты: задать securityContext, сетевые политики и RBAC. Пригодится при подготовке кластера к аудиту. CX Codex +1 412установок

Из того же набора21

Весь набор →
event-driven-architecture Скилл event-driven-architecture для Claude Code помогает проектировать системы на событиях: event sourcing, CQRS, саги и обмен сообщениями. Охватывает микросервисы и распределённые транзакции. CX Codex +1 118установок dashboard-designer Скилл dashboard-designer для Claude Code помогает спроектировать дашборд: выбрать KPI, расположить блоки и настроить визуальную иерархию. Запускается на запросы о структуре панели мониторинга или выборе BI-инструмента. CX Codex +1 109установок terraform-best-practices Скилл terraform-best-practices внедряет инженерные стандарты Terraform: разбиение на модули, блокировку стейта, разделение сред и валидацию в CI/CD. CX Codex +1 109установок mermaid-diagramming Скилл mermaid-diagramming учит агента рисовать диаграммы Mermaid: блок-схемы, sequence-диаграммы, ERD, состояния, Gantt и архитектурные виды, отдельно базовую и стилизованную версию. CX Codex +1 105установок user-journey-mapping Скилл user-journey-mapping для Claude Code помогает составить карту пути пользователя с этапами, точками контакта, эмоциями и проблемами. Запускается при анализе пользовательского опыта или конверсии. CX Codex +1 102установок tutorial-design Скилл tutorial-design помогает проектировать пошаговые туториалы, воркшопы и практические руководства с контрольными точками и разбором частых ошибок. CX Codex +1 102установок requirements-discovery Скилл requirements-discovery для Claude Code помогает собирать требования, определять границы проекта и готовить PRD. Запускается при обсуждении новой функции, интервью со стейкхолдерами или проверке спецификации. CX Codex +1 101установок api-gateway-patterns Скилл api-gateway-patterns для проектирования API-шлюзов в микросервисных архитектурах: маршрутизация, аутентификация, rate limiting, композиция запросов. CX Codex +1 101установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой