Free tech learning for everyone, from basics to pro

Network ArchitectureNetworking SecurityAdvanced

Kubernetes networking for network engineers: pods, CNI, services, ingress and network policies

In short: Kubernetes gives every pod its own IP address and expects all pods to reach each other without NAT. A CNI plugin builds this pod network, either as an overlay or by routing pod subnets, sometimes with BGP to the physical network. Services give groups of pods a stable address, ingress or the Gateway API exposes HTTP applications, and network policies act as a firewall between pods.

The networking model

Kubernetes runs containers in pods, spread across many nodes (VMs or servers). Its networking rules are simple to state:

  • every pod gets its own IP address;
  • pods can reach all other pods, on any node, without NAT;
  • agents on a node can reach all pods on that node.

How this is achieved is left to a CNI (Container Network Interface) plugin.

Kubernetes networking layersIngress / GatewayHTTP routing from outsideServicesstable virtual IP for a set of podsPod network (CNI)every pod gets an IPNode networkthe underlying VMs or servers
Figure 1. Each layer solves a different problem: reaching pods, finding them, and exposing them.

CNI plugins

  • Overlay designs (Flannel VXLAN, Calico VXLAN or IP-in-IP) encapsulate pod traffic between nodes, so the physical network only sees node addresses. Easy to deploy anywhere; adds overhead and hides pod traffic from the network.
  • Routed designs (Calico BGP, Cilium with BGP) advertise each node's pod subnet to the physical network, often peering with top-of-rack switches. Pods are reachable directly, with no encapsulation.
  • Cloud CNIs (AWS VPC CNI, Azure CNI) give pods addresses from the cloud VPC, so they are first-class citizens of the cloud network (which uses a lot of IP space).
  • Cilium uses eBPF in the Linux kernel for fast networking, load balancing, security and observability.

Services

Pods come and go, and their IPs change. A Service gives a stable virtual IP and DNS name for a set of pods selected by labels, and load-balances across them (through kube-proxy rules or eBPF).

  • ClusterIP: reachable only inside the cluster (the default).
  • NodePort: opens a port (30000 to 32767) on every node.
  • LoadBalancer: asks the cloud or an on-premises load balancer (such as MetalLB) for an external IP.

Cluster DNS (CoreDNS) resolves names like payroll.finance.svc.cluster.local.

Ingress and the Gateway API

For web applications, an ingress controller (NGINX, Traefik, HAProxy, cloud load balancers) acts as a reverse proxy: it terminates TLS and routes requests by host name and path to Services. The newer Gateway API is the successor, with clearer roles for platform and application teams and support for more protocols.

Network policies

By default, all pods can talk to all pods. NetworkPolicy objects, enforced by the CNI, act as a firewall: for example "pods labelled app=payroll-db accept traffic only from pods labelled app=payroll-api on port 5432". Start with a default-deny policy per namespace and allow what is needed (see the Kubernetes network policies note).

Connecting to the physical network

  • Plan pod and service CIDRs so they do not overlap with corporate or cloud ranges.
  • With routed CNIs, agree BGP peering with the data centre fabric, including route filters.
  • Egress from pods usually appears as the node's IP (SNAT), which affects firewall rules; egress gateways can give stable source addresses.
  • Watch MTU with overlays.

Real-world example: the firewall that blocked random pods

A company's on-premises firewall allowed a Kubernetes cluster to reach a database by listing a few pod IPs. Every time pods restarted with new addresses, connections failed. The team configured an egress gateway so all traffic from that namespace left through two fixed IPs, and updated the firewall rule to those, making the connection stable.

Practice

What does a CNI plugin do?
It implements the pod network, giving pods IP addresses and connectivity across nodes.
What is the purpose of a Kubernetes Service?
To give a changing set of pods a stable virtual IP and DNS name, and load-balance traffic across them.
What is the default traffic behaviour between pods without network policies?
All pods can talk to all other pods.

Key takeaways

  • Every pod gets an IP and can reach every other pod without NAT.
  • CNI plugins build the pod network as an overlay or routed design (often with BGP).
  • Services give stable addresses; ingress and Gateway API expose web apps.
  • Use network policies, non-overlapping CIDRs and planned egress addresses.
Tracks your learning on this device only. See your progress on the learning paths.
Verified author✓ Valid
Issued to
Mohamed Fayas
Role
Founder of FM TecHub
Credentials
CCNABTEC HND Network EngineeringBEng (Hons) Computer Networking & Cloud Security
Issuer
FM TecHub · fmtechub.com

He writes practical, plain-English guides on networking, security and cloud.

More about the author →

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Email updates: coming soon

New notes, tools and security news from FM TecHub by email, explained simply. Free. We're not collecting email addresses yet; see our privacy policy.

PortServiceStatus
SMTP/25Email updatesopening soon

Meanwhile, stay connected: