Md Tarek — Portfolio© 2026

Full-stack Developer

System Design — built to hold up.

dhaka → remote, worldwide

Loading experience

Md TarekTarek
Tech

Kubernetes Networking Explained: Services, Ingress & CNI

By: Md Tarek · 17 Oct 2026

Kubernetes cluster networking with services, pods and ingress traffic flow
Kubernetes cluster networking with services, pods and ingress traffic flow

Executive Summary & Key Takeaways

  • Every Pod gets its own IP, but Pod IPs are ephemeral. A Pod that restarts gets a new IP, which is why you never talk to Pods directly — you talk to a Service, which is a stable virtual IP (or a headless DNS entry) fronting a selector-matched set of Pods.
  • kube-proxy implements Services using iptables, IPVS, or (newer) eBPF. IPVS scales better than iptables for thousands of Services because it uses a hash table instead of linear rules.
  • Ingress is L7 routing (HTTP host/path) on top of a controller like nginx or Traefik; it needs an IngressController running in the cluster to actually do the work.
  • The CNI plugin is the actual network — Calico, Cilium, Flannel — it wires up pod-to-pod connectivity and network policy. Cilium uses eBPF and gives you fine-grained, identity-based policy.
  • NetworkPolicy is opt-in. By default pods can talk to each other; you must explicitly deny with a policy that selects pods and restricts ingress/egress.

1. The Four Networking Problems Kubernetes Solves

Kubernetes networking is really four separate problems: pod-to-pod, pod-to-service, external-to-service, and pod-to-external. Each is solved by a different layer, and conflating them is where most debugging time goes.

  • Pod-to-pod — handled by the CNI, which routes packets between node subnets.
  • Pod-to-service — kube-proxy programs the node to rewrite the virtual service IP to a backing pod IP.
  • External-to-service — an Ingress (L7) or a Service of type LoadBalancer/NodePort (L4).
  • Pod-to-external — SNAT through the node so return traffic can route back.

2. Services, Endpoints and EndpointSlices

A Service selects Pods by label and maintains an Endpoints object (now sharded as EndpointSlices for scale). When a Pod dies, its endpoint is removed, and the Service stops routing to it. This is the indirection that makes rolling deploys safe.

apiVersion: v1
kind: Service
metadata:
  name: notes-api
spec:
  selector:
    app: notes-api
  ports:
    - port: 80
      targetPort: 8080

3. CNI Choice and NetworkPolicy

| Plugin | Data plane | Policy model | Best when | |---|---|---|---| | Flannel | VXLAN / host-gw | none (needs Calico) | simple overlay | | Calico | iptables / eBPF | rich NetworkPolicy | enterprise defaults | | Cilium | eBPF | identity-based, L7 | observability + policy |

A minimal deny-by-default posture starts with a NetworkPolicy that allows only same-namespace traffic, then opens specific paths.

FAQ

Why can't I reach my Service from outside? Check that the Service has a selector that matches running pods, the targetPort matches the containerPort, and (for L7) your IngressController is actually deployed and has an address.

What's the difference between Ingress and a Service Mesh? Ingress is north-south (traffic entering the cluster); a service mesh (Istio, Linkerd) is east-west (pod-to-pod) with mTLS, retries, and observability.