Understanding Pod Communication and Calico Networking Modes in Kubernetes
This article explains how containers communicate within a pod, between pods, and with services in Kubernetes, and compares Calico's IPIP and BGP networking modes, detailing their traffic handling, suitable scenarios, efficiency, and configuration steps.
In Kubernetes, container communication follows several patterns:
Intra‑pod communication : multiple containers inside the same pod communicate via the loopback interface ( lo).
Pod‑to‑pod communication : pods talk directly using their pod IPs; no translation is required.
Pod‑to‑service communication : a pod accesses a service through the service’s cluster IP, which forwards traffic to the target pod IP via iptables or ipvs.
Service‑to‑external communication : services expose endpoints outside the cluster (details omitted).
Calico IPIP Network
The IPIP mode encapsulates traffic in a tunl0 device, creating a tunnel that carries packets across different subnet ranges. It is suitable when pods that need to communicate reside in separate subnets, solving cross‑subnet routing issues. The encapsulation adds overhead, so efficiency is slightly lower.
Calico BGP Network
When Calico is installed, the default network mode is IPIP. To switch to BGP, edit calico.yaml and set CALICO_IPV4POOL_IPIP to off. BGP uses routing information to direct traffic, making it ideal for pods within the same subnet or large‑scale networks. It operates with native host‑gateway routing, offering higher efficiency.
Full-Stack DevOps & Kubernetes
Focused on sharing DevOps, Kubernetes, Linux, Docker, Istio, microservices, Spring Cloud, Python, Go, databases, Nginx, Tomcat, cloud computing, and related technologies.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
