| name | implementing-kubernetes-network-policy-with-calico |
| description | Implement Kubernetes network segmentation using Calico NetworkPolicy and GlobalNetworkPolicy for zero-trust pod-to-pod communication. |
| domain | cybersecurity |
| subdomain | container-security |
| tags | ["calico","kubernetes","network-policy","network-segmentation","zero-trust","cni"] |
| version | 1.0 |
| author | mahipal |
| license | Apache-2.0 |
| nist_csf | ["PR.PS-01","PR.IR-01","ID.AM-08","DE.CM-01"] |
Implementing Kubernetes Network Policy with Calico
Overview
Calico is an open-source CNI plugin that provides fine-grained network policy enforcement for Kubernetes clusters. It implements the full Kubernetes NetworkPolicy API and extends it with Calico-specific GlobalNetworkPolicy, supporting policy ordering, deny rules, and service-account-based selectors.
When to Use
- When deploying or configuring implementing kubernetes network policy 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 (v1.24+)
- Calico CNI installed (v3.26+)
kubectl and calicoctl CLI tools
- Cluster admin RBAC permissions
Installing Calico
Operator-based Installation (Recommended)
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.27.0/manifests/tigera-operator.yaml
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.27.0/manifests/custom-resources.yaml
kubectl get pods -n calico-system
watch kubectl get pods -n calico-system
kubectl apply -f https://raw.githubusercontent.com/projectcalico/calico/v3.27.0/manifests/calicoctl.yaml
Verify Calico is Running
kubectl get pods -n calico-system
kubectl exec -n calico-system calicoctl -- calicoctl node status
kubectl exec -n calico-system calicoctl -- calicoctl get ippool -o wide
Kubernetes NetworkPolicy
Default Deny All Traffic
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name:
{}
{}