kubernetes/pkg/proxy/conntrack
Baf fd81afe040 kube-proxy: clear stale conntrack entries for UDP services with no endpoints
The conntrack reconciler skips services without serving endpoints, so
conntrack entries established while endpoints existed are never removed
when a UDP service scales down to zero. The REJECT (iptables) / reject
(nftables) rule installed for such services does not cover those flows:
they are DNATed to the deleted endpoint IP before the rule, which
matches on the service IP, can be evaluated. One-way UDP senders (e.g.
statsd clients) refresh the 30s conntrack timeout with every packet, so
the stale flows blackhole traffic to the deleted pod IP indefinitely;
recovery only happens when the service gets an endpoint again.

This was handled before the reconciler rewrite (kubernetes#127318):
the event-based cleanup cleared entries for every deleted UDP endpoint
regardless of how many endpoints remained.

Process services with an empty endpoints set instead of skipping them,
so every entry directed to their ClusterIP, LoadBalancer IP and
ExternalIP frontends is treated as stale and deleted.

NodePort cleanup is still skipped for services without serving
endpoints: NodePort entries are matched on the destination port only,
and with an empty endpoints set that would also remove UDP flows not
owned by kube-proxy (e.g. traffic to an unrelated host on the same
port).
2026-06-11 19:01:48 +01:00
..
cleanup.go kube-proxy: clear stale conntrack entries for UDP services with no endpoints 2026-06-11 19:01:48 +01:00
cleanup_test.go kube-proxy: clear stale conntrack entries for UDP services with no endpoints 2026-06-11 19:01:48 +01:00
conntrack.go build: remove deprecated '// +build' tag 2025-12-18 12:16:21 +01:00
conntrack_test.go build: remove deprecated '// +build' tag 2025-12-18 12:16:21 +01:00
doc.go Mark conntrack/fake as linux-only, add non-OS doc.go 2024-01-25 23:15:49 -05:00
fake.go build: remove deprecated '// +build' tag 2025-12-18 12:16:21 +01:00
filter.go build: remove deprecated '// +build' tag 2025-12-18 12:16:21 +01:00
filter_test.go build: remove deprecated '// +build' tag 2025-12-18 12:16:21 +01:00
sysctls.go Consistently import pkg/proxy/apis/config as kubeproxyconfig 2026-04-29 08:51:50 -04:00
sysctls_test.go Consistently import pkg/proxy/apis/config as kubeproxyconfig 2026-04-29 08:51:50 -04:00