Dataplane routing and dual stack
Follow a Service connection
A Service gives clients a stable destination while Pods change. Imagine a catalog client on node-a connecting to inventory at a virtual address. DNS supplies an address; a Service dataplane maps the destination to an eligible endpoint. A CNI networking implementation provides Pod connectivity; the Service forwarding implementation may be a separate component or integrated into it. Neither the Service IP nor DNS proves that an endpoint is ready. Inspect the Service, EndpointSlices, address family, readiness and actual application response separately.
Client -> DNS -> Service VIP -> Service dataplane -> ready endpoint -> application responseCompare forwarding implementations
On Linux, kube-proxy can program iptables rules, IPVS with supporting rules, or nftables rules, subject to release and kernel support. Treat IPVS as a migration lane: upstream guidance is moving toward nftables; do not infer a removal date from a blog headline. An eBPF-based implementation such as Cilium can handle Service translation using kernel hooks and maps instead of kube-proxy in a supported configuration. This changes observability, host firewall interactions and compatibility. Verify kernel, CNI and proxy versions, protocols, source-IP behavior and a rollback plan before migrating. Do not mix implementations by simply turning off kube-proxy.
iptables: netfilter rulesIPVS: kernel virtual-server tables plus supporting rulesnftables: netfilter nftables ruleseBPF replacement: implementation-specific hooks and mapsPlan dual-stack addresses
IPv4 and IPv6 are separate address families, not interchangeable strings. A dual-stack cluster needs compatible network and Service CIDRs, node configuration, CNI, DNS, policy and application listeners. SingleStack selects one family; PreferDualStack requests both when available; RequireDualStack requires both. The order in ipFamilies determines the primary Service family where supported. In the static example below, IPv4 is primary; actual Service addresses are allocated by the control plane. Test both A and AAAA resolution, matching endpoint families and application responses. A single-family client cannot use an arbitrary address of the other family without a separate translation mechanism.
apiVersion: v1kind: Servicemetadata: name: inventory namespace: mesh-labspec: selector: app: inventory ipFamilyPolicy: RequireDualStack ipFamilies: [IPv4, IPv6] ports: - port: 80 targetPort: 8080Distinguish hard locality from preference
internalTrafficPolicy: Local restricts internal Service traffic to eligible node-local endpoints; if there are none, the client can lose connectivity even if another node has a healthy backend. externalTrafficPolicy applies to external-facing Service traffic; Local can preserve source addresses in supported paths but requires careful health and capacity planning. trafficDistribution expresses preferences rather than a hard isolation rule; check the supported values, topology hints and precedence for the chosen release. ClientIP session affinity can favor the same backend across connections from an observed source IP; NAT may cause many clients to share that IP. It does not store application sessions or guarantee continuity after endpoint replacement.
node-a: no ready local endpointnode-b: one ready endpointinternalTrafficPolicy=Local -> no eligible endpoint on node-ainternalTrafficPolicy=Cluster -> node-b is a candidateDiagnose capacity, MTU and discovery
For a hypothetical allocator with 32 usable addresses and 29 allocated, three remain; a rollout requesting four more cannot fit in this pool. Actual usable capacity depends on the allocator, reservations, per-node blocks and provider limits. Encapsulation can reduce payload capacity: with a 1500-byte outer MTU and assumed 50-byte overhead, the inner MTU budget is 1450 bytes; actual overhead depends on protocol, address family and encryption. Investigate small requests succeeding while larger ones fail, but do not assume MTU is the cause without evidence. Track DNS latency, error rates, cache behavior and search-domain expansion before tuning. Across clusters, the Multicluster Services API can use ServiceExport and ServiceImport plus implementation-managed endpoints and DNS; it requires a compatible controller and actual network reachability. Standard Service DNS alone does not create cross-cluster routes.
32 - 29 = 3 available addresses1500 - 50 = 1450 bytes (illustrative inner MTU)Practice and verification
Review the offline fixtures under lab-fixtures/advanced-networking-mesh/ and run python validate_offline.py from that folder. Predict outcomes first. No network or cluster is used. The tests implement explicitly simplified rules, not a Kubernetes or mesh emulator.
Further reading
- https://kubernetes.io/docs/reference/networking/virtual-ips/ — Service proxy modes, policies, affinity and locality
- https://kubernetes.io/docs/concepts/services-networking/dual-stack/ — IP families and Service family policies
- https://kubernetes.io/docs/concepts/services-networking/service/ — Service abstraction and traffic distribution
- https://kubernetes.io/docs/concepts/services-networking/topology-aware-routing/ — Topology-aware routing and hints
- https://docs.cilium.io/en/stable/network/kubernetes/kubeproxy-free/ — Cilium eBPF Service replacement and limitations
- https://multicluster.sigs.k8s.io/concepts/multicluster-services-api/ — Multicluster Service discovery abstractions
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Dataplane routing and dual stack — knowledge check
Compare service implementations and IP families
What selects eligible Service endpoints?
What happens to internal Local traffic if no eligible endpoint is on the client node?
Which policy requires both IP families?
How many free addresses remain in a 32-address usable pool with 29 allocated?
What does ClientIP affinity guarantee?