Dual-Stack IPv4/IPv6 Networking in Kubernetes
Enable dual-stack clusters and services that speak both IPv4 and IPv6.
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
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.
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.
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.
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.
How it works, step by step
Step 1 of 41. 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.
- 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
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.
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.
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?
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
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.