Pod Networking — How Pods Communicate in Kubernetes¶
Pod Networking is the networking model that enables Kubernetes Pods to communicate with each other, regardless of whether they run on the same node or different nodes. Kubernetes follows a flat network model, where every Pod receives its own unique IP address and can communicate directly with every other Pod without requiring Network Address Translation (NAT). This networking model is implemented by the Container Network Interface (CNI) plugin and forms the foundation of Kubernetes communication. Every Kubernetes Administrator, DevOps Engineer, Platform Engineer, Site Reliability Engineer (SRE), Cloud Architect, and Network Engineer should understand Pod networking.
Learning Path¶
Course Progress
What You'll Learn¶
After completing this lesson, you'll be able to:
- Understand Kubernetes Pod networking
- Learn how Pods receive IP addresses
- Understand same-node and cross-node communication
- Explore Pod CIDR and Cluster CIDR
- Learn routing between Pods
- Troubleshoot Pod networking issues
- Design production-ready Kubernetes networking
Prerequisites¶
Complete:
- Linux Networking
- Routing
- Container Network Interface (CNI)
- Kubernetes Fundamentals
Basic understanding of:
- Network Namespaces
- Virtual Ethernet (veth)
- IP Routing
Why Do We Need Pod Networking?¶
Imagine a Kubernetes cluster with:
- 20 Nodes
- 500 Pods
- 100 Services
Questions arise:
- How does one Pod reach another?
- What IP address does each Pod receive?
- How do Pods communicate across nodes?
- Who configures the routes?
These are solved through:
Kubernetes Networking Model¶
Kubernetes defines four core networking principles:
- Every Pod receives a unique IP address.
- Pods communicate directly without NAT.
- Nodes can communicate with all Pods.
- Pods can communicate across nodes.
These principles make application communication simple and consistent.
What is Pod Networking?¶
Pod Networking is:
Every Pod behaves like an independent host on the cluster network.
Pod IP Address¶
Each Pod receives:
Example:
Applications communicate using these Pod IPs.
Network Namespace¶
Each Pod runs inside its own:
Every namespace contains:
- Network Interface
- Routing Table
- IP Address
- Loopback Interface
This provides network isolation between Pods.
Virtual Ethernet (veth)¶
Each Pod connects to the node through a:
Architecture:
One interface resides inside the Pod.
The other resides on the Kubernetes node.
Pod Creation Workflow¶
kubectl apply
↓
API Server
↓
Scheduler
↓
Node
↓
kubelet
↓
Container Runtime
↓
CNI Plugin
↓
Assign Pod IP
↓
Configure Routes
↓
Pod Ready
Networking is configured before the Pod becomes available.
Same-Node Communication¶
Pods on the same node communicate directly.
Example:
Traffic never leaves the node.
Benefits:
- Low Latency
- High Performance
Cross-Node Communication¶
Pods on different nodes communicate through the cluster network.
Example:
The CNI plugin configures routes or overlay tunnels to make this communication possible.
Pod CIDR¶
Each node receives a range of Pod IP addresses.
Example:
Node 1
Node 2
Every Pod on a node receives an IP from that node's Pod CIDR.
Cluster CIDR¶
The Cluster CIDR defines the complete Pod address space.
Example:
Subdivided into:
Routing Between Nodes¶
When Pod A communicates with Pod B:
Depending on the CNI, routing may use:
- Native Layer 3 Routing
- VXLAN
- Geneve
- IP-in-IP
Overlay Networking¶
Some CNI plugins create an overlay network.
Example:
Advantages:
- Easy Deployment
- Works Across Existing Networks
Disadvantages:
- Encapsulation Overhead
- Slightly Higher Latency
Native Routing¶
Other CNI plugins use direct routing.
Advantages:
- Lower Latency
- Better Throughput
- Simpler Packet Processing
Kubernetes DNS and Pod Communication¶
Although Pods can communicate using IP addresses:
this is not recommended because Pod IPs are ephemeral.
Instead, Kubernetes Services and Domain Name System (DNS) provide stable endpoints.
Pod Lifecycle and IP Addresses¶
When a Pod is deleted:
Applications should not depend on Pod IPs remaining constant.
Kubernetes Perspective¶
Pods communicate:
- Same Node
- Different Nodes
- Across Availability Zones
- Across Regions (depending on cluster architecture)
The networking model remains consistent.
Cloud Provider Perspective¶
Amazon EKS¶
Uses:
- Amazon VPC CNI
- Calico
- Cilium
Pods may receive VPC IP addresses.
Azure AKS¶
Uses:
- Azure CNI
- Cilium (in supported configurations)
Pod networking integrates with Azure Virtual Networks.
Google GKE¶
Uses:
- VPC-native Networking
- Alias IPs
- Dataplane V2
Pods communicate using Google Cloud VPC networking.
Enterprise Architecture¶
Communication occurs over the Kubernetes network without requiring manual route configuration by the application.
Pod Communication Example¶
Each Pod communicates using its assigned cluster IP.
CLI Examples¶
Display Pods with IP addresses.
Describe a Pod.
View node information.
View Pod CIDRs.
Common Networking Components¶
| Component | Purpose |
|---|---|
| Pod IP | Unique Pod Address |
| Pod CIDR | IP Range for One Node |
| Cluster CIDR | Cluster-wide Pod Address Space |
| Network Namespace | Pod Isolation |
| veth Pair | Pod-to-Host Connectivity |
| CNI Plugin | Network Configuration |
Hands-on Lab¶
Task 1¶
List Pods with IP addresses.
Task 2¶
Display Pod details.
Task 3¶
Display node Pod CIDRs.
Task 4¶
Deploy two Pods on the same node and verify connectivity using:
Task 5¶
Deploy two Pods on different nodes and verify communication.
Task 6¶
Capture Pod traffic using:
inside the node.
Task 7¶
Compare:
- Native Routing
- VXLAN Overlay
for a production Kubernetes cluster.
Task 8¶
Draw a Kubernetes networking architecture showing:
- Pod
- Network Namespace
- veth Pair
- Node
- Cluster Network
- Remote Node
- Destination Pod
Explain how a packet travels from one Pod to another on a different node.
Production Troubleshooting¶
Problem:
Check:
- Pod IP Address
- CNI Plugin Health
- Pod CIDR Configuration
- Node Routes
- Network Policies
- Firewall Rules
- CNI Logs
Workflow:
Source Pod
↓
Network Namespace
↓
veth Pair
↓
Node
↓
Cluster Route
↓
Destination Node
↓
Destination Pod
Pod Networking vs Traditional VM Networking¶
| Traditional VM | Kubernetes Pod |
|---|---|
| VM IP Address | Pod IP Address |
| Virtual NIC | veth Pair |
| Physical Network | CNI Plugin |
| Static Infrastructure | Dynamic Workloads |
| Manual Configuration | Automated Networking |
Common Mistakes¶
❌ Using Pod IPs for long-term communication.
✅ Use Kubernetes Services for stable endpoints.
❌ Assuming Pod IPs never change.
✅ Design applications to tolerate Pod recreation.
❌ Ignoring Pod CIDR planning.
✅ Allocate sufficient address space before deployment.
❌ Overlooking CNI health.
✅ Monitor CNI components and networking logs.
❌ Debugging applications before checking networking.
✅ Verify Pod IPs, routes, and connectivity first.
Best Practices¶
- Never hardcode Pod IP addresses.
- Use Services for stable communication.
- Plan Cluster CIDR and Pod CIDR carefully.
- Select a production-ready CNI plugin.
- Monitor Pod networking continuously.
- Enable Network Policies for security.
- Use observability tools to inspect network traffic.
- Test cross-node communication regularly.
Interview Questions¶
Beginner¶
- What is Pod Networking?
- Why does every Pod receive its own IP address?
- What is a Pod CIDR?
- What is a Cluster CIDR?
Intermediate¶
- Explain same-node and cross-node Pod communication.
- Compare overlay networking and native routing.
- Why should applications avoid using Pod IP addresses directly?
- How does the CNI plugin enable Pod communication?
Architect Level¶
- Design networking for a large multi-node Kubernetes cluster.
- Explain Pod networking across Availability Zones.
- How would you troubleshoot intermittent Pod-to-Pod communication failures in production?
Summary¶
In this lesson, you learned:
- Kubernetes Pod Networking
- Pod IP Addressing
- Network Namespaces
- veth Pairs
- Same-Node Communication
- Cross-Node Communication
- Pod CIDR
- Cluster CIDR
- Overlay Networking
- Native Routing
Pod networking is the foundation of communication within Kubernetes. Every Pod receives a unique IP address, enabling direct communication across the cluster without traditional NAT. Combined with CNI plugins, routing, and network namespaces, Kubernetes provides a simple yet powerful networking model that scales from small development clusters to large enterprise environments.
Key Takeaways¶
- Every Pod receives a unique IP address.
- Pods communicate directly without traditional NAT.
- Pod CIDR defines the IP range for Pods on a node.
- Cluster CIDR defines the overall Pod address space.
- Same-node communication uses local networking, while cross-node communication relies on the CNI plugin.
- Applications should communicate through Kubernetes Services instead of relying on Pod IP addresses.
What's Next?¶
In the next lesson, you'll learn about Service Networking.
You'll explore:
- Kubernetes Services
- ClusterIP
- NodePort
- LoadBalancer
- ExternalName
- Service Discovery
- kube-proxy
- Traffic Flow
By the end of the lesson, you'll understand how Kubernetes Services provide stable networking for dynamic Pods and enable reliable communication within and outside the cluster.