Chuyển đến nội dung
Skillpedia
Triển khai và đám mây (DevOps)35k · #8020

implementing-container-network-policies-with-calico

Skill này làm gì

Công cụ này giúp kiểm soát lưu lượng mạng giữa các container (chương trình chạy trong “hộp ảo”) bằng Calico. Nó cho phép bạn tạo quy tắc bảo mật để quyết định container nào được giao tiếp với nhau, bảo vệ chính máy chủ và kiểm soát truy cập internet theo tên website.

Khi nào nên dùng

  • ✓Khi bạn cần một quy tắc bảo mật ảnh hưởng đến nhiều “phòng” (namespace) cùng lúc.
  • ✓Khi bạn muốn bảo vệ “máy chủ chính” (host) nơi các container chạy.
  • ✓Khi bạn cần chỉ cho phép truy cập internet tới các website cụ thể (theo tên, như google.com).

Liên kết skill

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-container-network-policies-with-calico/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-container-network-policies-with-calico/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tạo quy tắc sao cho chỉ container của nhóm bán hàng mới truy cập được cơ sở dữ liệu, còn các container khác chỉ truy cập được trang tin tức.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ dùng các lệnh đặc biệt (calicoctl) để tạo và kiểm tra quy tắc mạng. Các quy tắc này xác định ai được giao tiếp với ai trong mạng container của bạn.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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.

Câu hỏi thường gặp

“Namespaces” là gì?

Hãy nghĩ namespace như các “phòng” riêng biệt trong máy chủ. Chúng giúp tổ chức và tách biệt các ứng dụng hoặc nhóm khác nhau.

“calicoctl” là gì?

Đây là công cụ dòng lệnh để quản lý các quy tắc mạng của Calico, giống như một điều khiển từ xa cho bảo mật mạng.

“Default-deny” nghĩa là gì?

Nghĩa là mặc định mọi thứ đều bị chặn. Bạn cần tạo các quy tắc cụ thể để cho phép những gì cần thiết, giúp mạng an toàn hơn.

Chi tiết

Mô tả gốc của tác giả

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

Độ phổ biến

Sao GitHub
35k
Vị trí xếp hạng
#8020
Giấy phép
Apache-2.0
Cập nhật
31/8/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự