Kubernetes Curriculum
On this page
- Networking Overview
- The Four Networking Problems Kubernetes Solves
- Problem 1: Container-to-Container Communication
- Problem 2: Pod-to-Pod Communication
- Problem 3: Pod-to-Service Communication
- Problem 4: External-to-Service Communication
- The Kubernetes Networking Model — Three Rules
- IP Address Ranges in a Kubernetes Cluster
- Port Concepts in Kubernetes Networking
- Network Traffic Flow Diagram — End to End
- Summary
Networking Overview
Networking in Kubernetes is one of the most important topics to understand deeply. Every Pod can communicate with every other Pod, every Service has a stable IP, and DNS works automatically across namespaces. But none of this happens by magic — it is built on a specific networking model enforced by every Kubernetes cluster.
This file gives you the complete mental model of Kubernetes networking before you go deep into the specific components in the files that follow.
The Four Networking Problems Kubernetes Solves
Kubernetes networking addresses four distinct communication scenarios:
Each is handled differently, and each has a different mechanism. Let us go through each one.
Problem 1: Container-to-Container Communication
Containers inside the same Pod share the same network namespace. They all have the same IP address and share all ports on that IP. They communicate via localhost:
The constraint: no two containers in the same Pod can bind to the same port (they share the port space).
Problem 2: Pod-to-Pod Communication
Kubernetes requires that every Pod gets a unique, routable IP address. Any Pod must be able to reach any other Pod by IP — directly, without NAT (Network Address Translation).
This is the flat network requirement. It means:
- Pod A at
10.0.1.45can reach Pod B at10.0.2.67directly - No port mapping needed
- No NAT translation between source and destination
- Works whether the Pods are on the same node or different nodes
On AWS EKS, this is implemented by the AWS VPC CNI Plugin — each Pod gets a real VPC IP address from your subnet's IP range. Pod traffic uses the VPC routing fabric directly:
Each Pod IP is a secondary private IP address on the worker node's ENI (Elastic Network Interface) — it is a real VPC IP, routable within your VPC.
Problem 3: Pod-to-Service Communication
Pods are ephemeral. Their IPs change every time they are recreated. You cannot build a reliable application that connects to specific Pod IPs.
Services solve this. A Service gets a stable ClusterIP — a virtual IP that never changes, even as the Pods behind it are replaced. When a Pod sends traffic to a Service's ClusterIP, kube-proxy intercepts it and redirects to one of the healthy Pod IPs:
Problem 4: External-to-Service Communication
Traffic from outside the cluster (from the internet, or from other AWS services) needs a way in. Kubernetes provides three mechanisms:
NodePort — exposes a port on every node's external IP. External traffic hits any node on that port and is forwarded to the Service.
LoadBalancer — provisions a cloud load balancer (AWS NLB or ALB) that distributes traffic to the Service.
Ingress — an HTTP/HTTPS router that sits in front of multiple Services and routes based on hostname and URL path.
For production on AWS, the LoadBalancer type (via AWS Load Balancer Controller) and Ingress (via AWS ALB Ingress Controller) are the standard patterns.
The Kubernetes Networking Model — Three Rules
The Kubernetes networking model imposes three requirements on any network implementation (CNI plugin):
Rule 1: Every Pod gets a unique IP. No two Pods in the cluster share an IP address.
Rule 2: All Pods can communicate with all other Pods without NAT. Pod A can reach Pod B directly by IP — no port mapping, no NAT, no proxy.
Rule 3: Agents on a node (kubelet, kube-proxy) can communicate with all Pods on that node. The node's host network can reach Pod IPs.
These three rules define the contract. Any network plugin (CNI) that satisfies them is valid for Kubernetes. Different CNI plugins implement this contract differently — AWS VPC CNI, Calico, Flannel, Cilium — but all deliver the same result.
IP Address Ranges in a Kubernetes Cluster
A cluster has three IP address ranges that must not overlap:
On EKS with the AWS VPC CNI:
These ranges must not overlap. If 172.20.0.0/16 is your Service CIDR, your VPC subnets (which become Pod IPs) must use a different range like 10.0.0.0/8.
Port Concepts in Kubernetes Networking
Several different "port" concepts appear in Kubernetes. Understanding each one prevents confusion:
Network Traffic Flow Diagram — End to End
Here is the complete flow for an external HTTP request reaching a Pod in EKS:
Each layer adds something:
- ALB handles TLS termination, health checks, and cross-AZ balancing
- Ingress handles HTTP routing by host and path
- Service provides a stable VIP and load balances across Pods
- kube-proxy performs the actual IP rewriting on each node
Summary
- Kubernetes networking handles four scenarios: container-to-container (localhost), Pod-to-Pod (flat network, no NAT), Pod-to-Service (ClusterIP via kube-proxy), and External-to-Service (LoadBalancer/Ingress)
- The core rule: every Pod gets a unique IP, and all Pods can reach each other without NAT — this is the flat network model
- On AWS EKS, the VPC CNI plugin gives each Pod a real VPC IP address — Pod traffic uses the VPC routing fabric directly
- Three non-overlapping CIDR ranges: Node CIDR (VPC subnets), Pod CIDR (Pod IPs), Service CIDR (ClusterIPs)
containerPortis informational only;portis the Service port;targetPortis the Pod port;nodePortis the node-level port- End-to-end flow: Internet → ALB → Ingress → Service → kube-proxy → Pod IP → Container
In the next file, 02-pod-to-pod-communication.md, you will go deep into how two Pods on different nodes communicate — the route taken, how the AWS VPC CNI assigns IPs, and what happens at each network hop.