Skip to main content

Calico

Purpose: Container networking and network policy

Version: v3.28.0

Namespace: calico-system

Description

CNI plugin providing networking and network policy enforcement. Replaced Flannel for better policy support and enhanced security.

Installation

Installed as CNI during cluster setup with kubeadm.

Features

  • Network Policies: Kubernetes NetworkPolicy support
  • IP Address Management (IPAM): Automatic IP allocation
  • Network Visualization: View network connections
  • Cross-node Communication: Pod-to-Pod communication

Components

ComponentPurpose
calico-nodeDaemonSet on each node for networking
calico-kube-controllersPolicy and IPAM controllers
calico-typhaScale extension for etcd

Network Policy Example

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: deny-all-ingress
namespace: my-app
spec:
podSelector: {}
policyTypes:
- Ingress
ingress:
- from:
- podSelector:
matchLabels:
app: allowed-app

Default Deny

Apply default deny policy for namespace:

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: default-deny-ingress
spec:
podSelector: {}
policyTypes:
- Ingress

Why Calico?

  • Network policies for pod isolation
  • Better security than Flannel
  • Supports NetworkSets for complex policies
  • Integration with Istio service mesh