implementing-container-network-policies-with-calico
它能做什么
这个工具可以帮你使用 Calico 控制容器之间的网络流量(容器是在虚拟“盒子”里运行的程序)。你可以创建安全规则,决定哪些容器可以互相通信,保护服务器本身,还可以按网站名称(比如 google.com)控制容器能否访问互联网。
适用场景
- ✓当你需要一条安全规则同时作用于多个“房间”(命名空间)时。
- ✓当你想保护运行容器的“主服务器”(主机)时。
- ✓当你只想允许容器访问特定网站(按域名,比如 google.com)时。
技能链接
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-container-network-policies-with-calico/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“创建规则,让只有销售团队的容器可以访问数据库,其他所有容器都只能访问新闻网站。”
每周 5 个新技能,1 分钟读完。
工作原理
这个工具使用专门的命令(calicoctl)来创建和检查网络规则。这些规则定义了你的容器网络中,谁可以和谁通信。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Implementing Container Network Policies with Calico
Overview
Calico provides Kubernetes-native and extended network policy enforcement through its CNI plugin. This skill covers creating and auditing Calico NetworkPolicy and GlobalNetworkPolicy resources to implement pod-to-pod traffic control, namespace isolation, egress restrictions, and DNS-based policy rules using calicoctl and the Kubernetes API.
When to Use
- When deploying or configuring implementing container network policies with calico capabilities in your environment
- When establishing security controls aligned to compliance requirements
- When building or improving security architecture for this domain
- When conducting security assessments that require this implementation
Prerequisites
- Kubernetes cluster with Calico CNI installed
- Python 3.9+ with
kubernetesclient library - calicoctl CLI tool installed and configured
- kubectl access with RBAC permissions for network policy management
Steps
Step 1: Audit Existing Network Policies
Use calicoctl and kubectl to inventory current network policies and identify unprotected namespaces.
Step 2: Implement Default-Deny Policies
Create default-deny ingress and egress policies per namespace as a zero-trust baseline.
Step 3: Create Workload-Specific Allow Rules
Define granular allow rules for legitimate pod-to-pod and pod-to-service communication.
Step 4: Validate Policy Enforcement
Test connectivity between pods to verify policies are correctly enforced.
Expected Output
JSON audit report listing all network policies, unprotected namespaces, policy rule counts, and connectivity test results.
常见问题
什么是“命名空间”(namespaces)?
你可以把命名空间想象成服务器里一个个独立的“房间”。它们可以帮助你整理和隔离不同的应用或团队。
什么是 calicoctl?
它是一个命令行工具,用来管理 Calico 的网络规则,就像网络安全的遥控器。
“default-deny”是什么意思?
意思是默认情况下什么都不允许。你需要创建具体的规则,只放行必要的访问,从而让网络更安全。
详情
作者的原始描述
Uses Calico's own policy CRDs beyond the upstream Kubernetes API - GlobalNetworkPolicy, HostEndpoint, NetworkSet, policy tiers, and DNS-based egress rules - applied and audited with calicoctl. Use when a policy must span namespaces or protect the host itself, when egress has to be expressed by domain name, or when ordering policies into tiers. Keywords: calicoctl, GlobalNetworkPolicy, HostEndpoint
热度
- GitHub 星标
- 35k
- 排名
- #8020
- 许可证
- Apache-2.0
- 更新时间
- 2026/8/31
评论
- …
同一仓库的更多技能
abusing-dpapi-for-credential-access
35k为你的 AI 智能体提供针对特定任务的现成指令,让它完成得更好、更快。
abusing-shadow-credentials-for-privesc
35k教你的 AI 智能体写出清晰、结构良好的文本。
achieving-cmmc-level-2-compliance
35k帮助你的智能体搭建符合 CMMC Level 2 合规要求的环境。它会落实安全要求,并管理必要的文档。
acquiring-disk-image-with-dd-and-dcfldd
35k帮助你的智能体创建硬盘的精确副本。这能确保调查过程中信息不丢失、不被篡改。