Interview's MateKubernetes
Interview's Mate

Kubernetes

K8s · Workloads · GitOps · Cloud

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Kubernetes topics
Lesson 58/ 160
03. Kubernetes Networking & Traffic Management

Dual-Stack IPv4/IPv6 Networking in Kubernetes

Enable dual-stack clusters and services that speak both IPv4 and IPv6.

AdvancedDual-Stack · IPv6 · ipFamilies3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

Dual-stack networking is a house with two street numbers; guests can find either entrance only if the route and sign exist end to end. The simple Kubernetes rule is: A dual-stack cluster allocates both Pod and Service address families and uses ipFamilies plus ipFamilyPolicy to select their order and whether a Service is SingleStack or PreferDualStack.

Think of it like…

Dual-stack networking is a house with two street numbers; guests can find either entrance only if the route and sign exist end to end.

Where you’ve seen it

During a connectivity incident, the network owner runs kubectl get node -o jsonpath='{.items[*].spec.podCIDRs}'; kubectl get svc api -o jsonpath='{.spec.ipFamilies}'. Expected evidence: A dual-stack cluster allocates both Pod and Service address families and uses ipFamilies plus ipFamilyPolicy to select their order and whether a Service is SingleStack or PreferDualStack. If the run instead shows this symptom, stop and restore the last known state: One missing node Pod CIDR, disabled provider prefix, or firewall rule for the second family creates a Service that exists but fails for IPv6 or IPv4 clients.

Words you’ll hear

Dual-Stack
For this lesson, Dual-Stack is the controlling idea: A dual-stack cluster allocates both Pod and Service address families and uses ipFamilies plus ipFamilyPolicy to select their order and whether a Service is SingleStack or PreferDualStack.
IPv6
IPv6 is the checkpoint; run kubectl get node -o jsonpath='{.items[*].spec.podCIDRs}'; kubectl get svc api -o jsonpath='{.spec.ipFamilies}' and inspect the owner chain. One missing node Pod CIDR, disabled provider prefix, or firewall rule for the second family creates a Service that exists but fails for IPv6 or IPv4 clients.
ipFamilies
ipFamilies is the outcome to preserve; the cost is explicit: Dual stack avoids address exhaustion and NAT assumptions, but every CNI, load balancer, security policy, and probe must be explicitly family-aware.
Verification evidence
The evidence command is kubectl get node -o jsonpath='{.items[*].spec.podCIDRs}'; kubectl get svc api -o jsonpath='{.spec.ipFamilies}'. It connects the declaration to this behavior: Enable dual-stack clusters and services that speak both IPv4 and IPv6.

Visual diagram

Loading interactive diagram

Theory & deep dive

How Dual-Stack reaches the intended state

Enable dual-stack clusters and services that speak both IPv4 and IPv6. A dual-stack cluster allocates both Pod and Service address families and uses ipFamilies plus ipFamilyPolicy to select their order and whether a Service is SingleStack or PreferDualStack.

The concrete checkpoint is kubectl get node -o jsonpath='{.items[*].spec.podCIDRs}'; kubectl get svc api -o jsonpath='{.spec.ipFamilies}'; compare the Dual-Stack owner, IPv6 state, and ipFamilies outcome instead of treating YAML acceptance as proof.

Verify IPv6, not only object creation

Run kubectl get node -o jsonpath='{.items[*].spec.podCIDRs}'; kubectl get svc api -o jsonpath='{.spec.ipFamilies}' after the change and correlate the result with Events and the owning object. A dual-stack cluster allocates both Pod and Service address families and uses ipFamilies plus ipFamilyPolicy to select their order and whether a Service is SingleStack or PreferDualStack.

Key takeaway: Dual-Stack is implemented only when this invariant remains observable: A dual-stack cluster allocates both Pod and Service address families and uses ipFamilies plus ipFamilyPolicy to select their order and whether a Service is SingleStack or PreferDualStack.

IPv6: failure boundary and production cost

One missing node Pod CIDR, disabled provider prefix, or firewall rule for the second family creates a Service that exists but fails for IPv6 or IPv4 clients. The prerequisite contract is concrete: A dual-stack cluster allocates both Pod and Service address families and uses ipFamilies plus ipFamilyPolicy to select their order and whether a Service is SingleStack or PreferDualStack.

Dual stack avoids address exhaustion and NAT assumptions, but every CNI, load balancer, security policy, and probe must be explicitly family-aware. A safe design limits blast radius, records the last good configuration, and uses kubectl get node -o jsonpath='{.items[*].spec.podCIDRs}'; kubectl get svc api -o jsonpath='{.spec.ipFamilies}' as a deterministic rollback checkpoint.

Recover from IPv6 drift

Capture the current state with kubectl get node -o jsonpath='{.items[*].spec.podCIDRs}'; kubectl get svc api -o jsonpath='{.spec.ipFamilies}', then correct the controlling manifest rather than patching a child object; the relevant divergence signal is specific: One missing node Pod CIDR, disabled provider prefix, or firewall rule for the second family creates a Service that exists but fails for IPv6 or IPv4 clients.

Key takeaway: Accept the trade-off consciously: Dual stack avoids address exhaustion and NAT assumptions, but every CNI, load balancer, security policy, and probe must be explicitly family-aware.

How it works, step by step

Step 1 of 4
Traffic author

1. Define the reachability contract

Declare selectors, listeners, routes, or policy and keep endpoint readiness explicit: A dual-stack cluster allocates both Pod and Service address families and uses ipFamilies plus ipFamilyPolicy to select their order and whether a Service is SingleStack or PreferDualStack.

Dual-Stack contract → owned state
Key numbers at this step
Goal
Enable dual-stack clusters and services that speak both IPv4 and IPv6.
Owner
Dual-Stack

When to use it & trade-offs

What it is

Enable dual-stack clusters and services that speak both IPv4 and IPv6. A dual-stack cluster allocates both Pod and Service address families and uses ipFamilies plus ipFamilyPolicy to select their order and whether a Service is SingleStack or PreferDualStack.

Why it matters: One missing node Pod CIDR, disabled provider prefix, or firewall rule for the second family creates a Service that exists but fails for IPv6 or IPv4 clients. The invariant at risk is specific: A dual-stack cluster allocates both Pod and Service address families and uses ipFamilies plus ipFamilyPolicy to select their order and whether a Service is SingleStack or PreferDualStack. The quickest fact check before changing the design is kubectl get node -o jsonpath='{.items[*].spec.podCIDRs}'; kubectl get svc api -o jsonpath='{.spec.ipFamilies}'.

When to reach for it

  • Use Dual-Stack to enforce this invariant: A dual-stack cluster allocates both Pod and Service address families and uses ipFamilies plus ipFamilyPolicy to select their order and whether a Service is SingleStack or PreferDualStack.
  • Use IPv6 evidence from kubectl get node -o jsonpath='{.items[*].spec.podCIDRs}'; kubectl get svc api -o jsonpath='{.spec.ipFamilies}' in reviews and incident timelines. Enable dual-stack clusters and services that speak both IPv4 and IPv6.
  • Choose the managed ingress or mesh route only when this cost is justified by governance or scale: Dual stack avoids address exhaustion and NAT assumptions, but every CNI, load balancer, security policy, and probe must be explicitly family-aware.

When to avoid or be careful

  • Avoid assuming Dual-Stack is complete after YAML submission; the required behavior is concrete: A dual-stack cluster allocates both Pod and Service address families and uses ipFamilies plus ipFamilyPolicy to select their order and whether a Service is SingleStack or PreferDualStack.
  • Avoid treating the next symptom as random; check the owner and state with kubectl get node -o jsonpath='{.items[*].spec.podCIDRs}'; kubectl get svc api -o jsonpath='{.spec.ipFamilies}' first: One missing node Pod CIDR, disabled provider prefix, or firewall rule for the second family creates a Service that exists but fails for IPv6 or IPv4 clients.
  • Avoid adopting a heavier platform wrapper before measuring its cost: Dual stack avoids address exhaustion and NAT assumptions, but every CNI, load balancer, security policy, and probe must be explicitly family-aware.

Native, manual, and managed paths for Dual-Stack

Built-in API path
Best for: Enable dual-stack clusters and services that speak both IPv4 and IPv6. A concrete incident check is kubectl get node -o jsonpath='{.items[*].spec.podCIDRs}'; kubectl get svc api -o jsonpath='{.spec.ipFamilies}'.

Strengths: A dual-stack cluster allocates both Pod and Service address families and uses ipFamilies plus ipFamilyPolicy to select their order and whether a Service is SingleStack or PreferDualStack.

Watch out: Dual stack avoids address exhaustion and NAT assumptions, but every CNI, load balancer, security policy, and probe must be explicitly family-aware. Recovery must also recognize this signal: One missing node Pod CIDR, disabled provider prefix, or firewall rule for the second family creates a Service that exists but fails for IPv6 or IPv4 clients.

Datapath-specific extension
Best for: Quickly testing the IPv6 assumption with kubectl get node -o jsonpath='{.items[*].spec.podCIDRs}'; kubectl get svc api -o jsonpath='{.spec.ipFamilies}'; the expected invariant is: A dual-stack cluster allocates both Pod and Service address families and uses ipFamilies plus ipFamilyPolicy to select their order and whether a Service is SingleStack or PreferDualStack.

Strengths: kubectl get node -o jsonpath='{.items[*].spec.podCIDRs}'; kubectl get svc api -o jsonpath='{.spec.ipFamilies}' gives immediate feedback without first building a platform layer.

Watch out: A manual change can hide drift, and unlike Dual-Stack, it does not make this symptom self-documenting: One missing node Pod CIDR, disabled provider prefix, or firewall rule for the second family creates a Service that exists but fails for IPv6 or IPv4 clients.

Managed ingress or mesh
Best for: Teams that need ipFamilies integrated with guardrails; the evidence path is kubectl get node -o jsonpath='{.items[*].spec.podCIDRs}'; kubectl get svc api -o jsonpath='{.spec.ipFamilies}'.

Strengths: Platform controls can wrap this exact behavior in policy or dashboards: A dual-stack cluster allocates both Pod and Service address families and uses ipFamilies plus ipFamilyPolicy to select their order and whether a Service is SingleStack or PreferDualStack.

Watch out: The added platform ownership buys value at this cost: Dual stack avoids address exhaustion and NAT assumptions, but every CNI, load balancer, security policy, and probe must be explicitly family-aware.

Interview signals & numbers to know

When this topic comes up

  • Interview anchor: A dual-stack cluster allocates both Pod and Service address families and uses ipFamilies plus ipFamilyPolicy to select their order and whether a Service is SingleStack or PreferDualStack.
  • Trace Dual-Stack to ipFamilies through IPv6; the invariant is: A dual-stack cluster allocates both Pod and Service address families and uses ipFamilies plus ipFamilyPolicy to select their order and whether a Service is SingleStack or PreferDualStack.
  • Recognize the symptom: One missing node Pod CIDR, disabled provider prefix, or firewall rule for the second family creates a Service that exists but fails for IPv6 or IPv4 clients.
  • Justify the cost: Dual stack avoids address exhaustion and NAT assumptions, but every CNI, load balancer, security policy, and probe must be explicitly family-aware.
  • Verify with kubectl get node -o jsonpath='{.items[*].spec.podCIDRs}'; kubectl get svc api -o jsonpath='{.spec.ipFamilies}' instead of only inspecting YAML.

Benchmarks & rules of thumb

2 -
IP families can be present together
128 -
bits in an IPv6 address compared with 32 bits in IPv4
1 -
primary ipFamilies entry determines default preference

Common mistakes & follow-ups

Common interview mistakes

  • Debugging only the child object misses the Dual-Stack owner contract: A dual-stack cluster allocates both Pod and Service address families and uses ipFamilies plus ipFamilyPolicy to select their order and whether a Service is SingleStack or PreferDualStack.
  • Ignoring this telltale condition leads to unrelated changes: One missing node Pod CIDR, disabled provider prefix, or firewall rule for the second family creates a Service that exists but fails for IPv6 or IPv4 clients.
  • Repeating kubectl get node -o jsonpath='{.items[*].spec.podCIDRs}'; kubectl get svc api -o jsonpath='{.spec.ipFamilies}' without an owner for remediation wastes retry cost. Dual stack avoids address exhaustion and NAT assumptions, but every CNI, load balancer, security policy, and probe must be explicitly family-aware.

Likely interviewer follow-ups

  • How would API output and runtime evidence prove this behavior: A dual-stack cluster allocates both Pod and Service address families and uses ipFamilies plus ipFamilyPolicy to select their order and whether a Service is SingleStack or PreferDualStack?
  • Which owner object, logs, and Events would you inspect for this symptom-One missing node Pod CIDR, disabled provider prefix, or firewall rule for the second family creates a Service that exists but fails for IPv6 or IPv4 clients-?
  • At what threshold would this cost become unacceptable: Dual stack avoids address exhaustion and NAT assumptions, but every CNI, load balancer, security policy, and probe must be explicitly family-aware?
Interview tip: Interview sequence: state the invariant, run kubectl get node -o jsonpath='{.items[*].spec.podCIDRs}'; kubectl get svc api -o jsonpath='{.spec.ipFamilies}', name the failure, then justify the cost. Invariant: A dual-stack cluster allocates both Pod and Service address families and uses ipFamilies plus ipFamilyPolicy to select their order and whether a Service is SingleStack or PreferDualStack. Failure: One missing node Pod CIDR, disabled provider prefix, or firewall rule for the second family creates a Service that exists but fails for IPv6 or IPv4 clients. Cost: Dual stack avoids address exhaustion and NAT assumptions, but every CNI, load balancer, security policy, and probe must be explicitly family-aware.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Dual-Stack IPv4/IPv6 Networking in Kubernetes with generative AI interview Q&A and hands-on practice.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
ExternalDNS for Automatic Cloud DNS Record Management
Next topic
Debugging Cluster Networking & DNS Issues