759 Commits

Author SHA1 Message Date
Predrag Rogic
f2170bc6c3 kube-proxy: log but don't exit if ipv4 or ipv6 is not available 2025-08-26 16:11:12 +01:00
Daman Arora
0dc51b16f9 kube-proxy: merge NodeEligibleHandler with NodeManager
ProxyHealthServer now consumes NodeManager to get the latest
updated node object for determining node eligibility.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
Co-authored-by: Dan Winship <danwinship@redhat.com>
2025-07-21 17:00:44 -04:00
Daman Arora
d4892fef76 kube-proxy: merge NodePodCIDRHandler with NodeManager
NodeManager, if configured with to watch for PodCIDR watch, watches
for changes in PodCIDRs and crashes kube-proxy if a change is
detected in PodCIDRs.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
Co-authored-by: Dan Winship <danwinship@redhat.com>
2025-07-21 17:00:44 -04:00
Daman Arora
373fb487f6 kube-proxy: add NodeManager to manage life-cycle based on NodeIPs
NodeManager initialises node informers, waits for cache sync and polls for
node object to retrieve NodeIPs, handle node events and crashes kube-proxy
when change in NodeIPs is detected.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
Co-authored-by: Dan Winship <danwinship@redhat.com>
2025-07-21 17:00:44 -04:00
Daman Arora
d21ca8674c kube-proxy: add NodeTopologyConfig for tracking topology labels
This simplifies how the proxier receives update for change in node
labels. Instead of passing the complete Node object we just pass
the proxy relevant topology labels extracted from the complete list
of labels, and the downstream event handlers will only be notified
when there are changes in topology labels.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2025-07-21 17:00:44 -04:00
Daman Arora
bc5088cbf3 Revert "Kube proxy node manager" 2025-07-15 19:34:05 +05:30
Daman Arora
fa9e466945 kube-proxy: merge NodeEligibleHandler with NodeManager
ProxyHealthServer now consumes NodeManager to get the latest
updated node object for determining node eligibility.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2025-07-11 23:06:44 +05:30
Daman Arora
c6735d9b3b kube-proxy: merge NodePodCIDRHandler with NodeManager
NodeManager, if configured with to watch for PodCIDR watch, watches
for changes in PodCIDRs and crashes kube-proxy if a change is
detected in PodCIDRs.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2025-07-11 23:06:44 +05:30
Daman Arora
c43104cbea kube-proxy: add NodeManager to manage life-cycle based on NodeIPs
NodeManager initialises node informers, waits for cache sync and polls for
node object to retrieve NodeIPs, handle node events and crashes kube-proxy
when change in NodeIPs is detected.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2025-07-11 21:48:52 +05:30
Daman Arora
af7abde0e5 kube-proxy: add NodeTopologyConfig for tracking topology labels
This simplifies how the proxier receives update for change in node
labels. Instead of passing the complete Node object we just pass
the proxy relevant topology labels extracted from the complete list
of labels, and the downstream event handlers will only be notified
when there are changes in topology labels.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2025-07-11 21:05:19 +05:30
Kubernetes Prow Robot
43bb11b5c1 Merge pull request #131534 from aroradaman/kube-proxy-ipt-init-error-2
kube-proxy: log iptables errors in platformCheckSupported
2025-06-06 21:08:38 -07:00
Daman Arora
858b88bcee kube-proxy: log ipt errors during platformCheckSupported
Signed-off-by: Daman Arora <aroradaman@gmail.com>
2025-06-07 01:14:33 +05:30
Kubernetes Prow Robot
2f94274c88 Merge pull request #131562 from logica0419/kube-proxy-string-concat
Add missing space in string concatenation (kube-proxy)
2025-05-27 13:36:22 -07:00
Kubernetes Prow Robot
ef66667c8e Merge pull request #131243 from danwinship/kube-proxy-cleanup
Improve `kube-proxy --cleanup` / cleanup on kube-proxy mode switch
2025-05-06 09:29:13 -07:00
logica0419
43a0da5880 add missing space in string concatenation (kube-proxy) 2025-04-30 23:35:25 +09:00
Ricardo Pchevuzinske Katz
68b1a950f9 kube-proxy should check global IPv6 enablement
IPv6 should also be checked if it is globally enabled. On nftables, today this
is hardcoded, so if a Linux Kernel disables IPv6 during its boot or doesn't
have IPv6 compiled, it will still try to use IPv6, which can lead to some
unexpected errors.

This change verifies if IPv6 is enabled by checking if the IPv6 network interfaces
proc file is available
2025-04-28 22:14:02 -03:00
Dan Winship
94530dad7b Move iptables/ipvs/ipset interface creation into CleanupLeftovers
This also fixes it so that ipvs.CleanupLeftovers only deletes
ipvs/ipset stuff once, rather than first deleting all of it on behalf
of the IPv4 Proxier and then no-op "deleting" it all again on behalf
of the IPv6 Proxier.
2025-04-10 09:03:25 -04:00
Dan Winship
c85083589c Clarify hostname vs node name in kube-proxy
Various parts of kube-proxy passed around a "hostname", but it is
actually the name of the *node* kube-proxy is running on, which is not
100% guaranteed to be exactly the same as the hostname. Rename it
everywhere to make it clearer that (a) it is definitely safe to use
that name to refer to the Node, (b) it is not necessarily safe to use
that name with DNS, etc.
2025-03-19 08:46:15 -04:00
Dan Winship
8c98dee1ed Add utiliptables.NewDualStack
Basically all callers want dual-stack-if-possible, so simplify that.

Also, tweak the startup-time checking in kubelet to treat "no iptables
support" as interesting but not an error.
2025-03-08 10:14:17 -05:00
Dan Winship
9c98d29795 Remove exec arg from utiliptables.New
It was there so you could mock the results via a FakeExec, but these
days any unit tests outside of pkg/util/iptables that want to mock
iptables results use a FakeIPTables instead of a real
utiliptables.Interface with a FakeExec.
2025-03-08 10:11:15 -05:00
Dan Winship
b5e9a8262e Remove exec arg from utilipset.New
Historically it took an exec argument so you could pass a FakeExec to
mock its behavior in unit tests, but it has a fake implementation now
that is much more useful for unit tests than trying to use the real
implementation with a fake exec. (The unit tests still use fake execs,
but they don't need to use a public constructor.) So remove the exec
args from the public constructors.
2025-03-07 10:43:52 -05:00
Dan Winship
36f5820ad1 Remove some unused proxy args/fields
Remove the utilexec.Interface args from the iptables/ipvs constructors
(which have been unused since the conntrack cleanup code was ported to
netlink).

Remove the EventRecorder fields from the iptables/ipvs Proxiers, which
have been unused since we removed the port-opener code in 2022.

Remove the strictARP field from the ipvs Proxier, which has apparently
always been unused (strictARP is only looked at at construct time).
2025-03-07 10:43:45 -05:00
Kubernetes Prow Robot
d7774fce9a Merge pull request #129653 from danwinship/nftables-ga
KEP-3866 nftables kube-proxy to GA
2025-02-13 08:42:20 -08:00
Dan Winship
83595f500a NFTablesProxyMode to GA 2025-02-13 10:27:14 -05:00
Siyuan Zhang
8fc3a33454 Refactor compatibility version code
Replace DefaultComponentGlobalsRegistry with new instance of componentGlobalsRegistry in test api server.

Signed-off-by: Siyuan Zhang <sizhang@google.com>

move kube effective version validation out of component base.

Signed-off-by: Siyuan Zhang <sizhang@google.com>

move DefaultComponentGlobalsRegistry out of component base.

Signed-off-by: Siyuan Zhang <sizhang@google.com>

move ComponentGlobalsRegistry out of featuregate pkg.

Signed-off-by: Siyuan Zhang <sizhang@google.com>

remove usage of DefaultComponentGlobalsRegistry in test files.

Signed-off-by: Siyuan Zhang <sizhang@google.com>

change non-test DefaultKubeEffectiveVersion to use DefaultBuildEffectiveVersion.

Signed-off-by: Siyuan Zhang <sizhang@google.com>

Restore useDefaultBuildBinaryVersion in effective version.

Signed-off-by: Siyuan Zhang <sizhang@google.com>

rename DefaultKubeEffectiveVersion to DefaultKubeEffectiveVersionForTest.

Signed-off-by: Siyuan Zhang <sizhang@google.com>

pass options.ComponentGlobalsRegistry into config for controller manager and scheduler.

Signed-off-by: Siyuan Zhang <sizhang@google.com>

Pass apiserver effective version to DefaultResourceEncodingConfig.

Signed-off-by: Siyuan Zhang <sizhang@google.com>

change statusz registry to take effective version from the components.

Signed-off-by: Siyuan Zhang <sizhang@google.com>

Address review comments

Signed-off-by: Siyuan Zhang <sizhang@google.com>

update vendor

Signed-off-by: Siyuan Zhang <sizhang@google.com>
2025-02-05 16:10:53 -08:00
Henry Wu
c5f66bfe70 Add statusz endpoint for kube-proxy 2025-02-04 22:20:31 -08:00
Kubernetes Prow Robot
45d0fddaf1 Merge pull request #128971 from aojea/servicecidr_ga
KEP-1880 Multiple Service CIDRs: Graduate to GA
2025-01-22 11:12:44 -08:00
Kubernetes Prow Robot
3a4c2a0bbb Merge pull request #129271 from aroradaman/dual_stack_healthz
Dual stack healthz server
2025-01-20 07:32:42 -08:00
Antonio Ojea
e340a07ccf update kube-proxy 2025-01-20 13:01:53 +00:00
Alexander Constantinescu
45529062e7 KEP-3836: 1.33 - remove feature gate 2025-01-17 17:04:40 +01:00
Daman Arora
d6c575532a pkg/proxy/healthcheck: rename 'proxier' to 'proxy'
KubeProxy operates with a single health server and two proxies,
one for each IP family. The use of the term 'proxier' in the
types and functions within pkg/proxy/healthcheck can be
misleading, as it may suggest the existence of two health
servers, one for each IP family.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2025-01-08 17:26:47 +05:30
Kubernetes Prow Robot
a19c27d3e3 Merge pull request #128985 from yongruilin/flagz-kube-proxy
feat: Add flagz endpoint for kube-proxy
2024-12-12 05:28:24 +00:00
yongruilin
ebb02bb6cc feat: Adds flagz page for kube-proxy 2024-12-11 12:01:47 -08:00
Dan Winship
49080bf02a Document the existence of nftables as a kube-proxy mode. 2024-11-12 09:51:52 -05:00
Daman Arora
0aa9dc84ab kube-proxy: use netutils.MultiListen for healthz and metrics server
Signed-off-by: Daman Arora <aroradaman@gmail.com>
(cherry picked from commit 7ce36f9bca)
2024-10-21 20:52:41 +05:30
Paco Xu
0e10a3a28c Revert "re: kube-proxy: internal config: refactor HealthzAddress and MetricsAddress " 2024-10-21 11:36:59 +08:00
Daman Arora
e63260082a kube-proxy: internal config: refactor Healthz and Metrics Address
Refactor Healthz with Metrics Address for internal configuration of
kube-proxy adhering to the v1alpha2 version specifications as detailed
in https://kep.k8s.io/784.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-10-14 22:56:23 +05:30
Daman Arora
48f1356b2f pkg/proxy: refactor NodePortAddresses to NodeAddressHandler
Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-10-14 21:49:29 +05:30
Daman Arora
7ce36f9bca kube-proxy: use netutils.MultiListen for healthz and metrics server
Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-10-08 17:48:11 +05:30
Antonio Ojea
df7215a144 unit test kube-proxy conntrack flags
Assert the flag behavior on kube-proxy using unit tests.
2024-10-05 13:29:34 +00:00
Matthieu MOREL
f777addb05 fix: use ErrorContains(t, err instead of Contains(t, err.Error()
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-09-26 22:22:20 +02:00
Sakuralbj
9064bfbe87 don't watch headless services on kube-proxy 2024-08-19 22:57:47 +08:00
Daman Arora
3d589bd18a kube-proxy: internal config: remove PortRange
Remove PortRange for internal configuration of kube-proxy
adhering to the v1alpha2 version specifications as detailed in
https://kep.k8s.io/784.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-07-23 19:56:23 +05:30
Daman Arora
c57e1156f5 kube-proxy: internal config: refactor ClusterCIDR
Refactor ClusterCIDR for internal configuration of kube-proxy
adhering to the v1alpha2 version specifications as detailed in
https://kep.k8s.io/784.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-07-23 19:45:29 +05:30
Daman Arora
380adb93cc kube-proxy: internal config: consolidate SyncPeriod and MinSyncPeriod
Consolidate SyncPeriod and MinSyncPeriod for internal configuration
of kube-proxy adhering to the v1alpha2 version specifications as
detailed in https://kep.k8s.io/784.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-07-23 19:34:40 +05:30
Daman Arora
6c10c97c3c kube-proxy: internal config: add Linux section
Introduce Linux section for internal configuration of kube-proxy
adhering to the v1alpha2 version specifications as detailed in
https://kep.k8s.io/784.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-07-16 19:20:48 +05:30
Daman Arora
7a6fec3ea7 kube-proxy: internal config: add Windows section
Introduce Windows section for internal configuration of kube-proxy
adhering to the v1alpha2 version specifications as detailed in
https://kep.k8s.io/784. This also introduces WindowsRunAsService
to v1alpha1 configuration.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-07-15 22:43:47 +05:30
Daman Arora
0d14f18f8f cmd/kube-proxy: refactor options test
Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-07-10 23:55:28 +05:30
Daman Arora
458b56811a cmd/kube-proxy: refactor server.go
Split server.go into server.go and options.go and same for
server_test.go

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-07-10 23:55:27 +05:30
Daman Arora
210ed2fc41 kube-proxy: fix error wrapping, error handling and deprecated methods
Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-07-10 23:51:17 +05:30