⚡ ~/naveed Interview Prep
⚡ Portfolio Home 👤 About Naveed Bio & Credentials 📫 Contact Naveed Get In Touch ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 1,000+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
← Back to All Networking & Cloud DNS Interview Questions Scenario 54 of 55 in Networking & Cloud DNS
Staff SRE / Principal Architect Networking Kubernetes Networking & Traffic Flow Classic Architecture
🎯 Target Role / Context: Staff SRE & Principal Cloud Architect Classic Question

Q: Explain the complete request flow to Kubernetes pod from a browser.

Master the complete request flow to Kubernetes pod from scratch: client DNS lookup, Anycast edge routing, TLS 1.3 termination at cloud load balancers, Ingress controller L7 routing, kube-proxy iptables DNAT, and Linux CNI network namespaces.

#Kubernetes #Networking #CoreDNS #Ingress #Kube-Proxy #CNI #AWS ALB
🎙️ Candidate Opening & Architectural Context
"In production architecture interviews, this is the definitive question used to test end-to-end systems mastery. When tracing the request flow to Kubernetes pod, I walk the interviewer through the exact journey of a packet across seven distinct layers: DNS lookup, TLS handshake, cloud load balancers, Ingress controllers, kernel netfilter DNAT, and container veth namespaces."
Advertisement
⚡ Recommended Practice Lab

Want to master this scenario in a live sandbox? KodeKloud's Istio Service Mesh & Advanced Kubernetes Networking Course covers this exact problem with hands-on terminal drills.

🛠️ Production Runbook & Step-by-Step Resolution

Direct Answer: In production architecture interviews, this is the definitive question used to test end-to-end systems mastery. When tracing the request flow to Kubernetes pod, I walk the interviewer through the exact journey of a packet across seven distinct layers: DNS lookup, TLS handshake, cloud load balancers, Ingress controllers, kernel netfilter DNAT, and container veth namespaces.

1

Browser DNS Resolution & Anycast Edge Routing

The user types https://app.example.com/checkout into the browser. The browser checks local DNS caches, then queries the OS recursive resolver, root nameservers, TLD nameservers, and authoritative DNS (e.g., AWS Route 53) returning the Anycast IP address of the Cloud CDN or Cloud Load Balancer.

# Inspect DNS resolution hops locally
dig +trace app.example.com
  • Local Cache Check: Browser DNS cache -> OS resolver cache -> /etc/hosts.
  • Recursive Resolution: ISP or corporate resolver queries Root (.), TLD (.com), and authoritative nameservers.
  • GeoDNS & Anycast: Route 53 or Cloudflare returns the closest Edge PoP IP via Anycast BGP routing.
2

TCP 3-Way Handshake & TLS 1.3 Cryptographic Negotiation

The browser initiates a TCP connection to the destination IP on port 443 via SYN -> SYN-ACK -> ACK. It negotiates TLS 1.3 cipher suites and validates the server X.509 certificate.

# Trace TCP connection and TLS handshake details
curl -Iv https://app.example.com/checkout
  • TCP Handshake: Client sends SYN; Cloud Load Balancer responds with SYN-ACK; Client sends ACK to establish socket.
  • TLS 1.3 Handshake: Client Hello sends Server Name Indication (SNI) and supported cipher suites; server returns certificate and completes 1-RTT cryptographic session establishment.
Advertisement
3

Cloud Load Balancer Ingress: Request Flow to Kubernetes Pod

The traffic reaches the AWS Application Load Balancer (ALB) or Network Load Balancer (NLB). The ALB terminates TLS, inspects HTTP headers, and forwards traffic into the Kubernetes cluster worker nodes.

# AWS Target Group health check query
aws elbv2 describe-target-health --target-group-arn <target-group-arn>
  • Instance Mode vs IP Mode: In Instance Mode, ALB routes to worker node NodePort. In IP Mode (via AWS VPC CNI), the ALB routes directly to pod IP addresses via TargetGroupBindings, bypassing NodePort overhead.
  • Header Injection: ALB appends X-Forwarded-For, X-Forwarded-Proto, and X-Amzn-Trace-Id headers.
4

Kubernetes Ingress Controller (Nginx / Envoy / Traefik)

The request arrives at the Ingress Controller pod running inside the cluster. The Ingress Controller matches the HTTP Host header and URI path against configured Kubernetes Ingress rules.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: app-ingress
  namespace: production
spec:
  rules:
  - host: app.example.com
    http:
      paths:
      - path: /checkout
        pathType: Prefix
        backend:
          service:
            name: checkout-service
            port:
              number: 8080
  • L7 Rule Evaluation: Evaluates host app.example.com and path /checkout.
  • Upstream Connection Pools: Ingress controller maintains persistent HTTP/2 keepalive connection pools to backend pods to eliminate TCP handshake latency.
5

Service Virtual IP (ClusterIP) & kube-proxy Packet DNAT

When the Ingress controller forwards traffic to the Kubernetes Service ClusterIP, the Linux kernel translates the virtual IP to a physical pod IP using netfilter/iptables, IPVS, or Cilium eBPF.

# Inspect iptables PREROUTING chains programmed by kube-proxy
sudo iptables -t nat -L KUBE-SERVICES -n -v
sudo iptables -t nat -L KUBE-SVC-CHECKOUT -n -v
  • Virtual IP Translation: ClusterIP is not a physical network interface; it exists solely as kernel packet filtering rules.
  • Random Load Balancing: iptables uses statistic mode (e.g. statistic mode random probability 0.5) to evenly distribute new TCP flows across healthy pod IPs tracked in EndpointSlices.
6

CNI Plugin & Linux Network Namespace (veth Pair) Traversal

The packet is encapsulated or routed directly across the worker node network by the Container Network Interface (CNI) plugin (AWS VPC-CNI, Calico, or Cilium).

# Inspect network namespaces and veth interface links on the host
ip netns list
ip link show type veth
  • veth Interface Pair: One end of the virtual ethernet pair resides in the host root network namespace, while the peer interface (eth0) lives inside the pod's isolated network namespace.
  • CNI Routing: In AWS VPC-CNI, pods have secondary ENI VPC private IPs with native AWS routing. In overlay CNIs (Calico/Flannel), packets are encapsulated in VXLAN/Geneve UDP frames across worker nodes.
7

Pod Container Runtime & Application Response

The packet arrives at the pod's eth0 interface, traverses the TCP socket buffer, and is accepted by the application server (e.g., Node.js, Go, Spring Boot). The application processes the request and sends HTTP 200 OK back through the conntrack reverse path.

# Test application port inside the pod network namespace
kubectl exec -it <pod-name> -n production -- curl -v http://localhost:8080/healthz
  • Socket Processing: Linux kernel wakes up the listening process via epoll/kqueue; the application parses HTTP headers and executes business logic.
  • Reverse Conntrack Un-DNAT: The outbound HTTP response packet traverses conntrack reverse translation, restoring the expected source IP so the client receives a seamless HTTP response.
8

How Do the Networking Layers Compare Across OSI Layers?

Comprehensive architectural comparison of networking layers involved in the complete request flow to Kubernetes pod:

⚡ End-to-End Kubernetes Ingress Packet Traversal Comparison Matrix
Network LayerComponentPrimary FunctionProtocol / Translation
Layer 7 (Application)Browser / ClientInitiates HTTP/2 request & DNS lookupDNS / HTTPS (Port 443)
Layer 4/7 (Edge)AWS ALB / NLBTerminates TLS & evaluates target healthTCP Proxy / HTTP Reverse Proxy
Layer 7 (Cluster Ingress)Ingress-Nginx / EnvoyRoutes by Host & Path to ServicesL7 HTTP Header Rewriting
Layer 3/4 (Cluster Mesh)kube-proxy / iptablesTranslates ClusterIP VIP to Pod IPKernel Netfilter DNAT
Layer 2/3 (Host CNI)AWS VPC-CNI / CalicoEncapsulates & routes to veth pairDirect Routing / VXLAN Overlay
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"A web request flow to Kubernetes pod is an end-to-end translation pipeline: DNS Anycast -> Cloud ALB -> Ingress Controller (L7) -> ClusterIP Service (kube-proxy kernel DNAT) -> CNI veth interface -> Container socket. Isolating issues requires knowing whether a failure is occurring at DNS, Cloud LB, Ingress routing, or kernel conntrack."
⚡ 60-Second Elevator Pitch Talking Points
  • DNS & Edge: Browser resolves Anycast IP via Route 53/CDN and establishes TCP 3-way handshake with TLS 1.3 negotiation.
  • Cloud Load Balancer: AWS ALB terminates TLS, injects X-Forwarded headers, and routes to worker nodes via NodePort or direct IP TargetGroupBindings.
  • Ingress Controller: Nginx/Envoy matches Host and Path rules, maintaining keepalive connection pools to backend endpoints.
  • Kernel DNAT: kube-proxy (or Cilium eBPF) translates the virtual ClusterIP to an active pod endpoint IP via iptables conntrack.
  • CNI & Namespace: CNI routes packet across node fabric into the pod's isolated network namespace via a virtual ethernet (veth) pair.
  • Container Execution: Pod application socket reads HTTP request, processes logic, and returns HTTP response via conntrack un-DNAT.
⛔ Critical Candidate Mistakes to Avoid in This Scenario

Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:

  1. Believing ClusterIP is a real physical network interface that can be pinged ClusterIPs are virtual software abstractions maintained by iptables/IPVS in kernel memory; ICMP ping packets are dropped because no interface owns the IP.
  2. Ignoring AWS ALB NodePort double-hop latency in standard Instance Mode Routing to NodePort causes kube-proxy to randomly DNAT packets across cross-node worker networks; using AWS Load Balancer Controller IP mode routes directly to pod ENIs.
  3. Overlooking MTU packet size clamping on overlay networks like VXLAN or Geneve Overlay encapsulation adds 50 bytes of overhead; without MTU clamping to 1450, large packets drop silently causing intermittent TCP connection freezes.
  4. Failing to configure upstream keepalive connections on Ingress controllers Opening a fresh TCP/TLS socket for every client request overloads pod CPU and causes latency spikes under high concurrency.
Advertisement
Want more Networking & Cloud DNS scenarios?
Explore our complete collection of scenario-based Networking & Cloud DNS interview runbooks.
Browse All Networking & Cloud DNS Questions →