Files
floci/docs
Simone Primarosa 31a19df6f5 feat(eks): enable IMDS and link-local metadata access from pod network (#4039)
Pods running without hostNetwork: true run in isolated network namespaces
managed by the CNI plugin (e.g. flannel in k3s). When pods send requests
to link-local addresses such as IMDS (169.254.169.254:80), the packets reach
the host node network namespace where CNI portmap installed
-A PREROUTING -m addrtype --dst-type LOCAL -j CNI-HOSTPORT-DNAT.
Because 169.254.169.254 is assigned to lo, the kernel evaluates its addrtype
as LOCAL, causing non-host-network pods to misroute or drop link-local traffic
if an ingress controller binds the same port.

This introduces EksPodNetworkRouting and an opt-in configuration setting
floci.services.eks.imds-pod-network (defaulting to false to preserve default
pod network isolation). When enabled alongside floci.services.eks.imds,
DNAT iptables rules are programmed in a dedicated FLOCI-LINK-LOCAL chain
inserted at rule 1 of PREROUTING. Requests originating from the cluster pod CIDR
targeting configured link-local endpoints (such as IMDS at 169.254.169.254:80,
and extensible for Pod Identity at 169.254.170.23:80) are explicitly DNATed
to the node's loopback listener, preempting CNI-HOSTPORT-DNAT without
conflicting with CNI portmap or flannel routing.

LinkLocalEndpoint strictly validates IPv4 literal format to reject non-IPs
or malformed strings. Rules are idempotent and degrade gracefully if iptables
configuration fails, ensuring cluster startup is never aborted.
2026-09-21 16:04:20 -04:00
..
2026-03-15 17:43:56 -05:00