Commit Graph

701 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
b2c32fb015
Merge pull request #123105 from danwinship/nodeport-addresses-primary
Add `--nodeport-addresses primary`, warn on empty `--nodeport-addresses`
2024-04-18 08:49:21 -07:00
Dan Winship
fde1af55d2 Warn users with bad --nodeport-addresses
If users don't pass any --nodeport-addresses, suggest they should pass
`--nodeport-addresses primary`, to avoid accepting NodePort
connections on all interfaces.

If users pass a single-stack --nodeport-addresses in what looks like a
dual-stack cluster, warn them that they probably ought to be passing a
dual-stack --nodeport-addresses.
2024-04-18 09:25:06 -04:00
Dan Winship
0b599aa8e3 Add --nodeport-addresses primary
The behavior when you specify no --nodeport-addresses value in a
dual-stack cluster is terrible and we can't fix it, for
backward-compatibility reasons. Actually, the behavior when you
specify no --nodeport-addresses value in a single-stack cluster isn't
exactly awesome either...

Allow specifying `--nodeport-addresses primary` to get the
previously-nftables-backend-specific behavior of listening on only the
node's primary IP or IPs.
2024-04-18 09:25:06 -04:00
Kubernetes Prow Robot
501cfb7482
Merge pull request #123545 from yangjunmyfm192085/fixproxymetrics
fix:When the --bind-address parameter of kube-proxy is configured as ipv6, the ip address of metrics listens to 127.0.0.1 by default, instead of::1
2024-04-18 00:01:03 -07:00
杨军10092085
86a31ca302 fix:When the parameter of kube-proxy is configured as ipv6, the ip address of metrics listens to 127.0.0.1 by default, instead of::1 2024-04-16 08:56:49 +08:00
Kubernetes Prow Robot
f139450e9b
Merge pull request #122885 from claudiubelu/unittests-10
unittests: Fixes unit tests for Windows (part 10)
2024-02-28 05:38:40 -08:00
Kubernetes Prow Robot
98bd90fbe2
Merge pull request #114672 from pohly/log-text-split-streams
log: split streams also for text output
2024-02-26 01:44:58 -08:00
Kubernetes Prow Robot
27ad20db35
Merge pull request #123005 from danwinship/minor-proxy-cleanup
Minor proxy cleanup
2024-01-28 08:44:38 -08:00
Dan Winship
da05076868 Reorganize a bit of winkernel proxier setup
Rather than doing winkernel-specific parsing of generic config data in
cmd/kube-proxy, do it in pkg/proxy/winkernel.
2024-01-28 09:30:51 -05:00
Dan Winship
33bd5fb3c4 Remove unused param to winkernel proxier
The winkernel code was originally based on the iptables code but never
made use of some parts of it. (e.g., it logs a warning if you didn't
set `--cluster-cidr`, even though it doesn't actually use
`--cluster-cidr` if you do set it.)
2024-01-28 09:30:51 -05:00
Kubernetes Prow Robot
c4feb19195
Merge pull request #122878 from liggitt/typecheck-kube-proxy-darwin
Re-allow building kube-proxy on all platforms
2024-01-26 16:32:12 +01:00
Dan Winship
536364266c Sort messy kube-proxy imports 2024-01-25 18:41:55 -05:00
Jordan Liggitt
d2c1a23a8a
Add stub methods for kube-proxy on non-linux/windows 2024-01-22 20:45:26 -08:00
Claudiu Belu
b8df7e7684 unittests: Fixes unit tests for Windows (part 10)
Currently, there are some unit tests that are failing on
Windows due to various reasons:

- Different "File not found" error messages on Windows.
- Files need to be closed on Windows before removing them.
- The default RootHnsEndpointName (root-hnsendpoint-name) flag value is 'cbr0'
- On Windows, Unix Domain sockets are not checked in the same way in golang, which is why
  hostutils_windows.go checks for it differently. GetFileType will return an error in this
  case. We need to check for it, and see if it's actually a Unix Domain Socket.
2024-01-22 13:43:42 +00:00
Daman Arora
4b40299133 pkg/proxy/nftables: handle traffic to cluster ip
NFTables proxy will now drop traffic directed towards unallocated
ClusterIPs and reject traffic directed towards invalid ports of
Cluster IPs.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-01-21 19:58:37 +05:30
Patrick Ohly
8f4c9c7605 k8s.io/component-base/logs: replace klog text implementation
This replaces the klog formatting and message routing with a simpler
implementation that uses less code. The main difference is that we skip the
entire unused message routing.

Instead, the same split output streams as for JSON gets implemented in the
io.Writer implementation that gets passed to the textlogger.
2024-01-17 13:50:03 +01:00
Lars Ekman
50b3ffc71f kube-proxy: LoadBalancerSourceRanges as *net.IPNet 2024-01-09 09:17:56 +01:00
Lars Ekman
564b80b1e1 kube-proxy: don't use invalid cidrs in unit test
CIDRs like 192.168.200.3/24 and fd00:20::1/64 replaced with
192.168.200.0/24 and fd00:20::/64
2024-01-09 09:17:31 +01:00
Ziqi Zhao
6b5e973e5f
Migrate cmd/kube-proxy to contextual logging (#122197)
* cmd/kube-proxy support contextual logging

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>

* use ktesting.NewTestContext(t) in unit test

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>

* use ktesting.NewTestContext(t) in unit test

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>

* remove unnecessary blank line & add cmd/kube-proxy to contextual section in logcheck.conf

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>

* add more contextual logging

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>

* new lint yaml

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>

---------

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
2024-01-08 17:30:18 +01:00
Dan Winship
c1ce1e00ee Properly build-tag the Linux kube-proxy backend code
This had to be able to build on OS X before to make verify-typecheck
pass, but now that that's fixed we can tag the code properly as being
linux-only.
2023-12-18 20:20:51 -05:00
Dan Winship
93860a5217 Distinguish iptables-based and nftables-based backends, do startup cleanup
When switching from iptables or ipvs to nftables, clean up old
iptables/ipvs rules. When switching the other way, clean up old
nftables rules.
2023-10-31 17:38:32 -04:00
Dan Winship
abb1a458a9 Create an nftables.Interface in nftables proxier
And update most of the comments to refer to "nftables" rather than
"iptables" (even though it doesn't actually do any nftables updating
at this point).

For now the proxy also internally creates a
utiliptablestesting.FakeIPTables to keep the existing sync code
compiling.
2023-10-31 17:38:29 -04:00
Dan Winship
1a6b9b811e Simplify nftables/proxier.go by removing localhost nodeport support
and related route_localnet setting / anti-martian-packet rule
2023-10-31 17:33:53 -04:00
Dan Winship
a70653143e Add a dummy nftables kube-proxy backend which is just a copy of iptables 2023-10-31 17:31:42 -04:00
Kubernetes Prow Robot
0c93f40374
Merge pull request #120995 from aroradaman/move-get-kernel-version
move GetKernelVersion out of pkg/proxy/ipvs
2023-10-31 20:23:41 +01:00
Daman Arora
9ae77364e9 pkg/proxy: configure tcp-be-liberal
Signed-off-by: Daman Arora <aroradaman@gmail.com>
2023-10-28 01:11:24 +05:30
Daman Arora
a375aa28ee pkg/proxy: move get kernel version out of ipvs proxier
Signed-off-by: Daman Arora <aroradaman@gmail.com>
2023-10-28 00:54:34 +05:30
Lars Ekman
4b59d2b05c kube-proxy: Optionally do privileged configs only
A new --init-only flag is added tha makes kube-proxy perform
configuration that requires privileged mode and exit. It is
intended to be executed in a privileged initContainer, while
the main container may run with a stricter securityContext
2023-10-24 07:01:31 +02:00
Kubernetes Prow Robot
b5ba899dfa
Merge pull request #118146 from aroradaman/fix/proxy-healthzserver
proxy healthz server for dualstack clusters
2023-10-16 21:19:25 +02:00
Daman Arora
bfda244e54 pkg/proxy: dual stack health checker
Signed-off-by: Daman Arora <aroradaman@gmail.com>
2023-10-16 16:11:18 +05:30
Daman Arora
4ea6ec738c pkg/proxy: add an ipFamily field to the winkernel proxier
Signed-off-by: Daman Arora <aroradaman@gmail.com>
2023-10-15 19:55:09 +05:30
Kubernetes Prow Robot
cf54acce5c
Merge pull request #120274 from danwinship/kube-proxy-config-docs
kube-proxy config/CLI doc fixups
2023-10-15 02:56:24 +02:00
Kubernetes Prow Robot
b47aa1c20e
Merge pull request #120808 from aroradaman/proxy-conntrack-udp-timeouts
Adding option to configure UDP timeouts for conntrack
2023-10-12 01:59:55 +02:00
Daman Arora
15ae6cc160 pkg/proxy: add flag to configure udp conntrack timeouts
Signed-off-by: Daman Arora <aroradaman@gmail.com>
2023-10-12 03:08:21 +05:30
Dan Winship
f3c786cbda Fix regression in cmd/kube-proxy/app unit test speed 2023-10-09 07:08:22 -04:00
Dan Winship
b2f0052d27 Make a certain ipv4-vs-ipv6 config error non-fatal, for backward compat 2023-10-05 12:57:29 -04:00
Dan Winship
9242cb1934 Rearrange kube-proxy config fields / CLI flags to make more sense. 2023-09-30 10:19:07 -04:00
Dan Winship
44cb330aa0 Improve kube-proxy config / CLI documentation 2023-09-30 10:18:16 -04:00
Kubernetes Prow Robot
dc28eeaa3a
Merge pull request #120565 from skitt/drop-deprecated-pointer-kube-proxy
kube-proxy: drop deprecated pointer package
2023-09-29 02:24:42 -07:00
Kubernetes Prow Robot
d393d4e151
Merge pull request #120574 from logicalhan/cslis
promote component SLIs to GA; remove feature gates for component slis
2023-09-14 22:52:12 -07:00
Lars Ekman
0df4a69f5c
Kube-proxy: Get nodeIPs for both families with dual-stack (#119525)
* Kube-proxy: handle dual-stack in detectNodeIPs()

* Updates
2023-09-11 09:30:23 -07:00
Han Kang
e6435e98ed promote component SLIs to GA; remove feature gates for component slis 2023-09-11 09:15:32 -07:00
Stephen Kitt
357d7804b8
kube-proxy: drop deprecated pointer package
This replaces deprecated k8s.io/utils/pointer functions with their ptr
equivalent.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2023-09-11 16:38:37 +02:00
Daman Arora
b97cb6dd00
Revert "Do not attempt to overwrite higher system (sysctl) values" 2023-09-06 00:42:48 +05:30
Patrick Ohly
6ddcdef29a kube-proxy: fix combination of --config and logging command line flags
When parsing a config file, all settings derived from command line flags are
discarded because only the config settings are used. That has been the
traditional behavior for non-logging flags.

But `--config ... -v=4` used to work until
71ef0dafa7 added logging to the configuration.
To restore the original behavior, kube-proxy now:
- parses flags
- reads the config file
- applies logging settings from the flags to the config loaded from file
- uses that merged config
2023-08-10 11:14:04 +02:00
Daman Arora
4e10ff91c5 pkg/proxy: move proxier health eventing to cmd/kube-proxy
Signed-off-by: Daman Arora <aroradaman@gmail.com>
2023-07-24 20:09:46 +05:30
Kubernetes Prow Robot
71f8a2405d
Merge pull request #119333 from liggitt/flushfrequencystring
Conditionally serialize flushFrequency as int
2023-07-16 07:09:06 -07:00
Jordan Liggitt
6c0ea702d4
Conditionally serialize flushFrequency as int 2023-07-16 08:37:37 -04:00
Kubernetes Prow Robot
f34365789d
Merge pull request #116470 from alexanderConstantinescu/kep-3836-impl
[Kube-proxy]: Implement KEP-3836
2023-07-15 05:43:04 -07:00
Kubernetes Prow Robot
d37c62dcbf
Merge pull request #117800 from cyclinder/loggin_format
Add '--logging-format' flag to kube-proxy
2023-07-13 08:40:37 -07:00