Kubernetes Networking Explained

Pod networking, Services, CNI and the packet path from a client to a container — explained the way a network engineer would draw it.

Published Jul 14, 2026Updated Aug 10, 202612 min read5 views
Featured
  • kubernetes
  • networking
  • security

The four rules of the model

  • Every pod gets its own routable IP address.

  • Pods can reach every other pod without NAT.

  • Nodes can reach pods without NAT.

  • The IP a pod sees for itself is the IP others see.

Everything else — CNI plugins, overlays, Services — is an implementation detail serving those four rules.

Where the CNI plugin fits

The kubelet does not configure networking. It calls a CNI binary that creates the veth pair, assigns an address from the node's pod CIDR and installs routes. Calico programs the host routing table (and optionally BGP), Cilium programs eBPF, Flannel typically builds a VXLAN overlay.

Bash
kubectl get nodes -o custom-columns=NAME:.metadata.name,POD_CIDR:.spec.podCIDR
kubectl -n kube-system get pods -l k8s-app=calico-node -o wide
ip route show | grep cali

Services are load-balancing rules, not processes

A ClusterIP is a virtual address that exists only as a rule in iptables or IPVS on every node. There is no process listening on it. That is why tcpdump on the service IP shows nothing and why a misconfigured kube-proxy breaks the cluster in a way that looks like DNS failure.

Type

Reachable from

Typical use

ClusterIP

Inside the cluster

Service-to-service traffic

NodePort

Any node IP on a high port

Bare-metal entry point behind an external LB

LoadBalancer

External LB address

Cloud or MetalLB in a homelab

Following a packet

  1. The client resolves the service name through CoreDNS to a ClusterIP.

  2. The first packet hits the node's kube-proxy rules and is DNAT'd to a pod IP.

  3. The CNI dataplane routes it to the node hosting that pod, encapsulating if an overlay is in use.

  4. conntrack records the translation so the return path is symmetric.

Network policy is default-allow until it is not

YAML
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: default-deny-ingress
  namespace: payments
spec:
  podSelector: {}
  policyTypes: [Ingress]
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-api-from-web
  namespace: payments
spec:
  podSelector:
    matchLabels: { app: api }
  ingress:
    - from:
        - namespaceSelector:
            matchLabels: { tier: web }
      ports:
        - protocol: TCP
          port: 8080

Debug checklist

  • DNS first: kubectl run tmp --rm -it --image=busybox -- nslookup api.payments

  • Then the endpoints: kubectl get endpointslices -n payments

  • Then the dataplane: node routes, conntrack, and the CNI agent logs.

Back to all docs