跳到正文
Skillpedia
部署与云(DevOps)35k · #8020

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-container-network-policies-with-calico/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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 kubernetes client 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

repo: mukul975/Anthropic-Cybersecurity-Skills

热度

GitHub 星标
35k
排名
#8020
许可证
Apache-2.0
更新时间
2026/8/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能