본문으로 건너뛰기
cccskills
무료GitHub에 공개

managing-calico

Use when working with Calico — calico networking and security management for Kubernetes. Covers network policy enforcement, BGP configuration, IPAM management, Felix agent status, Typha health, WireGuard encryption, and global network sets. Use when managing Calico network policies, debugging routing issues, configuring BGP peering, or monitoring Felix/Typha health.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

연동 도구Kubernetes
설치 방법 보기

포함된 파일(1)

  • SKILL.md10.6 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Calico Management Skill

Manage Calico networking, network policies, BGP configuration, IPAM, and Felix status.

Core Helper Functions

#!/bin/bash

# Calicoctl wrapper
calico_cmd() {
    calicoctl "$@" 2>/dev/null
}

# Calicoctl with datastore config
calico_get() {
    local resource="$1"
    calicoctl get "$resource" -o json 2>/dev/null
}

# Calico via kubectl (operator-managed)
calico_kubectl() {
    kubectl get "$@" -o json 2>/dev/null
}

MANDATORY: Discovery-First Pattern

Always check Calico component health and node status before policy operations.

Phase 1: Discovery

#!/bin/bash

echo "=== Calico Version ==="
calicoctl version 2>/dev/null || \
kubectl get deploy calico-kube-controllers -n calico-system -o jsonpath='{.spec.template.spec.containers[0].image}' 2>/dev/null || \
kubectl get deploy calico-kube-controllers -n kube-system -o jsonpath='{.spec.template.spec.containers[0].image}' 2>/dev/null

echo ""
echo "=== Calico Node Status ==="
calicoctl node status 2>/dev/null || \
kubectl get pods -n calico-system -l k8s-app=calico-node -o json 2>/dev/null | jq -r '
    .items[] | "\(.metadata.name)\t\(.spec.nodeName)\t\(.status.phase)\t\(.status.containerStatuses[0].restartCount) restarts"
' | column -t

echo ""
echo "=== Component Health ==="
# calico-node (Felix + BIRD)
echo "calico-node pods:"
kubectl get pods -n calico-system -l k8s-app=calico-node --no-headers 2>/dev/null | head -10 || \
kubectl get pods -n kube-system -l k8s-app=calico-node --no-headers 2>/dev/null | head -10

echo ""
# Typha (optional scaler)
echo "Typha pods:"
kubectl get pods -n calico-system -l k8s-app=calico-typha --no-headers 2>/dev/null | head -5

echo ""
echo "=== IPAM Summary ==="
calicoctl ipam show 2>/dev/null || echo "Use 'calicoctl ipam show' for IP allocation details"

echo ""
echo "=== Network Policies Count ==="
kubectl get networkpolicies -A --no-headers 2>/dev/null | wc -l | xargs echo "K8s NetworkPolicies:"
calicoctl get globalnetworkpolicies -o json 2>/dev/null | jq '.items | length' | xargs echo "Calico GlobalNetworkPolicies:"

Output Rules

  • TOKEN EFFICIENCY: Target <=50 lines per output
  • Use calicoctl get -o json with jq for Calico resources
  • Use kubectl -o json for standard K8s network policies

Common Operations

Network Policy Dashboard

#!/bin/bash
NS="${1:-}"

echo "=== Calico Global Network Policies ==="
calicoctl get globalnetworkpolicies -o json 2>/dev/null | jq -r '
    .items[] | "\(.metadata.name)\t\(.spec.order // 999)\t\(.spec.selector // "all()")\tingress:\(.spec.ingress | length) egress:\(.spec.egress | length)"
' | column -t | head -15

echo ""
echo "=== Calico Network Policies (namespaced) ==="
calicoctl get networkpolicies ${NS:+--namespace "$NS"} -A -o json 2>/dev/null | jq -r '
    .items[] | "\(.metadata.name)\t\(.metadata.namespace)\t\(.spec.selector // "all()")\t\(.spec.order // 999)"
' | column -t | head -15

echo ""
echo "=== K8s Network Policies ==="
kubectl get networkpolicies ${NS:+-n "$NS"} -A -o json 2>/dev/null | jq -r '
    .items[] | "\(.metadata.name)\t\(.metadata.namespace)\t\(.spec.policyTypes | join(","))"
' | column -t | head -15

echo ""
echo "=== Global Network Sets ==="
calicoctl get globalnetworksets -o json 2>/dev/null | jq -r '
    .items[] | "\(.metadata.name)\t\(.spec.nets | length) CIDRs"
' | column -t | head -10

BGP Configuration

#!/bin/bash
echo "=== BGP Configuration ==="
calicoctl get bgpConfiguration default -o json 2>/dev/null | jq '{
    log_severity: .spec.logSeverityScreen,
    node_to_node_mesh: .spec.nodeToNodeMeshEnabled,
    as_number: .spec.asNumber,
    service_cluster_ips: .spec.serviceClusterIPs,
    service_external_ips: .spec.serviceExternalIPs
}'

echo ""
echo "=== BGP Peers ==="
calicoctl get bgpPeers -o json 2>/dev/null | jq -r '
    .items[] | "\(.metadata.name)\t\(.spec.peerIP)\tAS\(.spec.asNumber)\t\(.spec.nodeSelector // "all()")"
' | column -t | head -15

echo ""
echo "=== Node BGP Status ==="
calicoctl node status 2>/dev/null | head -20

echo ""
echo "=== BIRD Routing Table ==="
# On a specific node
for pod in $(kubectl get pods -n calico-system -l k8s-app=calico-node -o jsonpath='{.items[*].metadata.name}' 2>/dev/null | tr ' ' '\n' | head -3); do
    echo "--- $pod ---"
    kubectl exec -n calico-system "$pod" -- birdcl show route 2>/dev/null | head -10
done

IPAM Management

#!/bin/bash
echo "=== IPAM Summary ==="
calicoctl ipam show 2>/dev/null

echo ""
echo "=== IP Pools ==="
calicoctl get ippools -o json 2>/dev/null | jq -r '
    .items[] | "\(.metadata.name)\t\(.spec.cidr)\t\(.spec.ipipMode // "Never")\t\(.spec.vxlanMode // "Never")\t\(.spec.natOutgoing)\t\(.spec.disabled // false)"
' | column -t

echo ""
echo "=== IP Reservations ==="
calicoctl get ipreservations -o json 2>/dev/null | jq -r '
    .items[]? | "\(.metadata.name)\t\(.spec.reservedCIDRs | join(","))"
' | column -t | head -10

echo ""
echo "=== Block Affinities ==="
calicoctl ipam show --show-blocks 2>/dev/null | head -20

echo ""
echo "=== IPAM Check (leaked IPs) ==="
calicoctl ipam check 2>/dev/null | head -15

Felix Status & Health

#!/bin/bash
echo "=== Felix Configuration ==="
calicoctl get felixConfiguration default -o json 2>/dev/null | jq '{
    log_severity: .spec.logSeverityScreen,
    reporting_interval: .spec.reportingInterval,
    iptables_refresh: .spec.iptablesRefreshInterval,
    route_refresh: .spec.routeRefreshInterval,
    wireguard_enabled: .spec.wireguardEnabled,
    bpf_enabled: .spec.bpfEnabled,
    floating_ips: .spec.floatingIPs
}'

echo ""
echo "=== Felix Metrics ==="
for pod in $(kubectl get pods -n calico-system -l k8s-app=calico-node -o jsonpath='{.items[*].metadata.name}' 2>/dev/null | tr ' ' '\n' | head -3); do
    echo "--- $pod ---"
    kubectl exec -n calico-system "$pod" -- wget -qO- http://localhost:9091/metrics 2>/dev/null \
        | grep -E "^felix_(active|iptables|route)" | head -10
done

echo ""
echo "=== Typha Status ==="
kubectl get pods -n calico-system -l k8s-app=calico-typha -o json 2>/dev/null | jq -r '
    .items[] | "\(.metadata.name)\t\(.status.phase)\t\(.status.containerStatuses[0].restartCount) restarts"
' | column -t

echo ""
echo "=== WireGuard Status ==="
calicoctl get felixConfiguration default -o json 2>/dev/null | jq '.spec.wireguardEnabled // false' | xargs echo "WireGuard enabled:"
kubectl get nodes -o json 2>/dev/null | jq -r '.items[] | "\(.metadata.name)\t\(.metadata.annotations["projectcalico.org/WireguardPublicKey"] // "not configured")"' | column -t | head -10

Host Endpoint & Profile Management

#!/bin/bash
echo "=== Host Endpoints ==="
calicoctl get hostEndpoints -o json 2>/dev/null | jq -r '
    .items[] | "\(.metadata.name)\t\(.spec.node)\t\(.spec.interfaceName)\t\(.spec.expectedIPs | join(","))"
' | column -t | head -15

echo ""
echo "=== Profiles ==="
calicoctl get profiles -o json 2>/dev/null | jq -r '
    .items[] | "\(.metadata.name)\t\(.spec.ingress | length) ingress\t\(.spec.egress | length) egress"
' | column -t | head -15

echo ""
echo "=== Workload Endpoints ==="
calicoctl get workloadEndpoints -o json 2>/dev/null | jq -r '
    .items[:20][] | "\(.metadata.name)\t\(.metadata.namespace)\t\(.spec.node)\t\(.spec.ipNetworks | join(","))"
' | column -t | head -15

Safety Rules

  • Read-only by default: Use calicoctl get, calicoctl ipam show, calicoctl node status
  • Never modify GlobalNetworkPolicies without confirmation -- can block all cluster traffic
  • BGP changes: Modifying BGP config can disrupt routing across the entire cluster
  • IPAM operations: IP pool changes affect pod IP allocation -- plan maintenance windows

Output Format

Present results as a structured report:

Managing Calico Report
══════════════════════
Resources discovered: [count]

Resource       Status    Key Metric    Issues
──────────────────────────────────────────────
[name]         [ok/warn] [value]       [findings]

Summary: [total] resources | [ok] healthy | [warn] warnings | [crit] critical
Action Items: [list of prioritized findings]

Target ≤50 lines of output. Use tables for multi-resource comparisons.

Anti-Hallucination Rules

  1. NEVER assume resource names — always discover via CLI/API in Phase 1 before referencing in Phase 2.
  2. NEVER fabricate metric names or dimensions — verify against the service documentation or --help output.
  3. NEVER mix CLI commands between service versions — confirm which version/API you are targeting.
  4. ALWAYS use the discovery → verify → analyze chain — every resource referenced must have been discovered first.
  5. ALWAYS handle empty results gracefully — an empty response is valid data, not an error to retry.

Counter-Rationalizations

ShortcutCounterWhy
"I'll skip discovery and check known resources"Always run Phase 1 discovery firstResource names change, new resources appear — assumed names cause errors
"The user only asked for a quick check"Follow the full discovery → analysis flowQuick checks miss critical issues; structured analysis catches silent failures
"Default configuration is probably fine"Audit configuration explicitlyDefaults often leave logging, security, and optimization features disabled
"Metrics aren't needed for this"Always check relevant metrics when availableAPI/CLI responses show current state; metrics reveal trends and intermittent issues
"I don't have access to that"Try the command and report the actual errorAssumed permission failures prevent useful investigation; actual errors are informative

Common Pitfalls

  • Datastore type: Calico uses either etcd or Kubernetes API -- check DATASTORE_TYPE environment variable
  • Policy ordering: Calico policies have explicit order field -- lower values match first
  • IPIP vs VXLAN: Overlay modes are per-pool -- mixing can cause connectivity issues
  • Felix restart loop: Often caused by invalid Felix configuration -- check calico-node pod logs
  • Namespace isolation: Calico namespace network policies only apply within the namespace -- use GlobalNetworkPolicy for cross-namespace rules

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Cloudflare GraphQL Analytics for zone traffic, firewall events, Workers metrics, and schema exploration. Use when querying Cloudflare analytics data or exploring the GraphQL API.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

cloudthinker-ai/CloudSkills62026년 4월 5일 업데이트

Use when working with Alloydb — google AlloyDB instance analysis, query insights, columnar engine optimization, maintenance windows, and cluster health.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

cloudthinker-ai/CloudSkills62026년 4월 5일 업데이트

Use when working with Aqua — aqua Security platform analysis. Covers container runtime protection, image assurance policies, compliance frameworks, vulnerability management, workload protection, and registry scanning. Use when analyzing container security posture, reviewing image compliance, investigating runtime alerts, or auditing security policies.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

cloudthinker-ai/CloudSkills62026년 4월 5일 업데이트

Use when working with Bigquery — google BigQuery job analysis, slot utilization, cost analysis, dataset management, and query optimization.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

cloudthinker-ai/CloudSkills62026년 4월 5일 업데이트

Use when working with Cassandra — apache Cassandra keyspace analysis, compaction strategies, repair status, nodetool operations, and cluster health monitoring.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

cloudthinker-ai/CloudSkills62026년 4월 5일 업데이트

Use when working with Checkov — checkov infrastructure-as-code security scanning. Covers Terraform, CloudFormation, Kubernetes, and Dockerfile scanning, policy management, custom checks, compliance frameworks, and suppression management. Use when scanning IaC for security misconfigurations, evaluating compliance, managing custom policies, or reviewing scan results.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

cloudthinker-ai/CloudSkills62026년 4월 5일 업데이트

cloudthinker-ai의 스킬 모두 보기

이 스킬의 문제 신고