使用生产就绪的网络策略、RBAC 配置和 Pod 安全标准保护您的 Kubernetes 集群。此技能提供全面的模板和纵深防御最佳实践。
下载技能 ZIP
在 Claude 中上传
前往 设置 → 功能 → 技能 → 上传技能
开启并开始使用
测试它
正在使用“k8s-security-policies”。 为 production 命名空间创建默认拒绝 NetworkPolicy
预期结果:
一个完整的 NetworkPolicy 清单,包含空的 podSelector 以及 Ingress 和 Egress 策略类型,默认阻止所有流量
正在使用“k8s-security-policies”。 为部署管理器角色生成 RBAC
预期结果:
一个具有 deployments 权限(完整 CRUD)和 pods 权限(只读)的 Role,以及用于绑定用户或 Service Account 的 RoleBinding
安全审计
安全All static analyzer findings are false positives. The skill contains documentation and YAML templates for Kubernetes security configurations. Network pattern detections reference metadata endpoint blocking (security best practice), and external command findings are bash examples in Markdown documentation, not executable code.
质量评分
你能构建什么
DevSecOps 工程师
在微服务之间实施网络隔离,并为 CI/CD 流水线强制实施最小权限访问控制
平台团队负责人
在多租户 Kubernetes 集群中建立安全基线和合规性控制
安全审计员
根据 CIS 基准和 NIST 框架审查和验证现有 Kubernetes 安全配置
试试这些提示
Create a NetworkPolicy that allows frontend pods to communicate with backend pods on port 8080 in the production namespace
Generate RBAC configuration for a service account that needs read-only access to ConfigMaps in the default namespace
Configure namespace labels to enforce restricted Pod Security Standards with audit and warn modes
Create a comprehensive security configuration including default deny NetworkPolicy, RBAC for developers, and Pod Security Standards for a new production namespace
最佳实践
- 从默认拒绝 NetworkPolicy 开始,然后显式允许所需流量
- 对 RBAC 应用最小权限原则——授予所需的最小权限
- 为每个应用程序使用专用的 ServiceAccount,而不是 default ServiceAccount
避免
- 在生产工作负载的 RBAC 中使用通配符(*)权限
- 以 root 用户运行容器或使用特权安全上下文
- 在没有明确 NetworkPolicy 规则的情况下允许不受限制的出站流量