Commit Graph

320 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
ad68c4a8b5
Merge pull request #87699 from michaelbeaumont/fix_66766
kube-proxy: Only open ipv4 sockets for ipv4 clusters
2020-02-13 23:54:18 -08:00
Andrew Sy Kim
1653476e3f proxier: use IPSet from k8s.io/utils/net to store local addresses
This allows the proxier to cache local addresses instead of fetching all
local addresses every time in IsLocalIP.

Signed-off-by: Andrew Sy Kim <kiman@vmware.com>
2020-02-11 16:44:34 -05:00
Andrew Sy Kim
313c3b81e3 iptables proxier: get local addresses only once per sync loop
This avoids fetching all local network interfaces everytime we sync an
external IP. For clusters with many external IPs this gets really
expensive. This change caches all local addresses once per sync.

Signed-off-by: Andrew Sy Kim <kiman@vmware.com>
2020-02-11 16:35:49 -05:00
Michael Beaumont
3eea0d1405
kube-proxy: Only open ipv4 sockets for ipv4 clusters 2020-01-30 18:54:16 +01:00
Rob Scott
47b2593d59
Creating new EndpointSliceProxying feature gate for kube-proxy
This creates a new EndpointSliceProxying feature gate to cover EndpointSlice
consumption (kube-proxy) and allow the existing EndpointSlice feature gate to
focus on EndpointSlice production only. Along with that addition, this enables
the EndpointSlice feature gate by default, now only affecting the controller.

The rationale here is that it's really difficult to guarantee all EndpointSlices
are created in a cluster upgrade process before kube-proxy attempts to consume
them. Although masters are generally upgraded before nodes, and in most cases,
the controller would have enough time to create EndpointSlices before a new node
with kube-proxy spun up, there are plenty of edge cases where that might not be
the case. The primary limitation on EndpointSlice creation is the API rate limit
of 20QPS. In clusters with a lot of endpoints and/or with a lot of other API
requests, it could be difficult to create all the EndpointSlices before a new
node with kube-proxy targeting EndpointSlices spun up.

Separating this into 2 feature gates allows for a more gradual rollout with the
EndpointSlice controller being enabled by default in 1.18, and EndpointSlices
for kube-proxy being enabled by default in the next release.
2020-01-17 16:17:40 -08:00
danielqsj
a8f2feaeb5 remove deprecated metrics of proxy 2020-01-10 17:05:38 +08:00
Kubernetes Prow Robot
5373fa3f59
Merge pull request #82462 from vllry/dualstack-iptables
Dualstack support for kube-proxy iptables mode
2020-01-07 04:38:20 -08:00
Kubernetes Prow Robot
30090d0809
Merge pull request #86665 from SataQiu/clean-proxy-20191227
kube-proxy: add some interface type assertions
2020-01-02 22:25:40 -08:00
SataQiu
134c545b96 proxy: add some interface type assertions 2019-12-27 18:30:25 +08:00
libnux
f0e01bcfde Change log level to 3 when --random-fully is not supported 2019-12-24 17:47:27 +08:00
Mark Janssen
a54e5cec54 Fix staticcheck failures for pkg/proxy/...
Errors from staticcheck:
pkg/proxy/healthcheck/proxier_health.go:55:2: field port is unused (U1000)
pkg/proxy/healthcheck/proxier_health.go:162:20: printf-style function with dynamic format string and no further arguments should use print-style function instead (SA1006)
pkg/proxy/healthcheck/service_health.go:166:20: printf-style function with dynamic format string and no further arguments should use print-style function instead (SA1006)
pkg/proxy/iptables/proxier.go:737:2: this value of args is never used (SA4006)
pkg/proxy/iptables/proxier.go:737:15: this result of append is never used, except maybe in other appends (SA4010)
pkg/proxy/iptables/proxier.go:1287:28: this result of append is never used, except maybe in other appends (SA4010)
pkg/proxy/userspace/proxysocket.go:293:3: this value of n is never used (SA4006)
pkg/proxy/winkernel/metrics.go:74:6: func sinceInMicroseconds is unused (U1000)
pkg/proxy/winkernel/metrics.go:79:6: func sinceInSeconds is unused (U1000)
pkg/proxy/winuserspace/proxier.go:94:2: field portMapMutex is unused (U1000)
pkg/proxy/winuserspace/proxier.go:118:2: field owner is unused (U1000)
pkg/proxy/winuserspace/proxier.go:119:2: field socket is unused (U1000)
pkg/proxy/winuserspace/proxysocket.go:620:4: this value of n is never used (SA4006)
2019-12-22 21:32:06 +01:00
Vallery Lancey
23957a6b28 Allow kube-proxy iptables mode to support dual-stack, with the meta-proxier. 2019-12-16 22:50:25 -08:00
Kubernetes Prow Robot
459b1d76bf
Merge pull request #85527 from aojea/fix#85414
Revert "kube-proxy: check KUBE-MARK-DROP"
2019-11-23 13:19:49 -08:00
Antonio Ojea
98be7831e4
Revert "kube-proxy: check KUBE-MARK-DROP"
This reverts commit 1ca0ffeaf2.

kube-proxy is not recreating the rules associated to the
KUBE-MARK-DROP chain, that is created by the kubelet.

Is preferrable avoid the dependency between the kubelet and
kube-proxy and that each of them handle their own rules.
2019-11-22 06:37:42 +01:00
Andrew Sy Kim
884582d892 proxier: improve node topology event handler logic
Signed-off-by: Andrew Sy Kim <kiman@vmware.com>
2019-11-15 08:53:56 -05:00
Roc Chan
80c6524cd0 kube-proxy: sync rules when current node labels change detected 2019-11-15 13:36:43 +08:00
Roc Chan
c9cf3f5b72 Service Topology implementation
* Implement Service Topology for ipvs and iptables proxier
* Add test files
* API validation
2019-11-15 13:36:43 +08:00
Rob Scott
a7e589a8c6
Promoting EndpointSlices to beta 2019-11-13 14:20:19 -08:00
Kubernetes Prow Robot
2b3540068b
Merge pull request #84422 from aojea/kubemarkdrop
kube-proxy: ensure KUBE-MARK-DROP exists
2019-11-03 13:41:39 -08:00
Kubernetes Prow Robot
85575e929b
Merge pull request #83387 from danwinship/proxy-error-retry
If an iptables proxier sync fails, retry after iptablesSyncPeriod
2019-10-31 21:53:23 -07:00
Dan Winship
2fd42dee95 If an iptables proxier sync fails, retry after iptablesSyncPeriod 2019-10-29 07:36:00 -04:00
Antonio Ojea
1ca0ffeaf2 kube-proxy: check KUBE-MARK-DROP 2019-10-27 18:46:51 +01:00
zouyee
a3e0ac2951 set config.BindAddress to IPv4 address "127.0.0.1" if not specified
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
2019-10-25 21:46:41 +08:00
Kubernetes Prow Robot
af6f302e46
Merge pull request #83498 from danwinship/proxy-health
Fix kube-proxy healthz server for proxier sync loop changes
2019-10-15 23:04:58 -07:00
Rob Scott
3924364585
Making iptables probability more granular in kube-proxy.
Until now, iptables probabilities had 5 decimal places of granularity.
That meant that probabilities would start to repeat once a Service
had 319 or more endpoints.

This doubles the granularity to 10 decimal places, ensuring that
probabilities will not repeat until a Service reaches 100,223 endpoints.
2019-10-07 17:37:33 -07:00
Dan Winship
f83474916e Fix kube-proxy healthz server for proxier sync loop changes
The proxy healthz server assumed that kube-proxy would regularly call
UpdateTimestamp() even when nothing changed, but that's no longer
true. Fix it to only report unhealthiness when updates have been
received from the apiserver but not promptly pushed out to
iptables/ipvs.
2019-10-04 13:37:09 -04:00
Dan Winship
0f10102c16 Better distinguish the two kinds of proxy health check servers
Kube-proxy runs two different health servers; one for monitoring the
health of kube-proxy itself, and one for monitoring the health of
specific services. Rename them to "ProxierHealthServer" and
"ServiceHealthServer" to make this clearer, and do a bit of API
cleanup too.
2019-10-04 10:37:58 -04:00
Dan Winship
3948f16ff4 Add iptables.Monitor, use it from kubelet and kube-proxy
Kubelet and kube-proxy both had loops to ensure that their iptables
rules didn't get deleted, by repeatedly recreating them. But on
systems with lots of iptables rules (ie, thousands of services), this
can be very slow (and thus might end up holding the iptables lock for
several seconds, blocking other operations, etc).

The specific threat that they need to worry about is
firewall-management commands that flush *all* dynamic iptables rules.
So add a new iptables.Monitor() function that handles this by creating
iptables-flush canaries and only triggering a full rule reload after
noticing that someone has deleted those chains.
2019-09-17 10:19:26 -04:00
Kubernetes Prow Robot
61ecdba9ca
Merge pull request #82289 from robscott/endpointslice-fixes
Fixing bugs related to Endpoint Slices
2019-09-05 09:03:10 -07:00
Rob Scott
8f9483d827
Fixing bugs related to Endpoint Slices
This should fix a bug that could break masters when the EndpointSlice
feature gate was enabled. This was all tied to how the apiserver creates
and manages it's own services and endpoints (or in this case endpoint
slices). Consumers of endpoint slices also need to know about the
corresponding service. Previously we were trying to set an owner
reference here for this purpose, but that came with potential downsides
and increased complexity. This commit changes behavior of the apiserver
endpointslice integration to set the service name label instead of owner
references, and simplifies consumer logic to reference that (both are
set by the EndpointSlice controller).

Additionally, this should fix a bug with the EndpointSlice GenerateName
value that had previously been set with a "." as a suffix.
2019-09-04 09:09:32 -07:00
Mike Spreitzer
d86d1defa1 Made IPVS and iptables modes of kube-proxy fully randomize masquerading if possible
Work around Linux kernel bug that sometimes causes multiple flows to
get mapped to the same IP:PORT and consequently some suffer packet
drops.

Also made the same update in kubelet.

Also added cross-pointers between the two bodies of code, in comments.

Some day we should eliminate the duplicate code.  But today is not
that day.
2019-09-01 22:07:30 -04:00
Kubernetes Prow Robot
4495d09282
Merge pull request #81430 from robscott/endpointslice-proxy
Adding EndpointSlice support for kube-proxy ipvs and iptables proxiers
2019-08-29 15:36:44 -07:00
Rob Scott
9665c590c7
Adding EndpointSlice support for kube-proxy ipvs and iptables proxiers 2019-08-29 01:06:52 -07:00
Kubernetes Prow Robot
454e8e6e92
Merge pull request #80514 from liuxu623/master
don't delete KUBE-MARK-MASQ chain in iptables/ipvs proxier
2019-08-28 23:49:56 -07:00
Kubernetes Prow Robot
0a486d97ed
Merge pull request #81415 from oxddr/asdf
kube-proxy: improve logging around network programming latency SLI.
2019-08-23 15:48:39 -07:00
Janek Łukaszewicz
c33be173bf kube-proxy: improve logging around network programming latency SLI. 2019-08-23 15:48:25 +02:00
Kubernetes Prow Robot
9c736445f5
Merge pull request #79846 from aramase/fix-golint-pkg/proxy
Fix golint failures in pkg/proxy
2019-08-23 00:51:17 -07:00
Kubernetes Prow Robot
37651f1cef
Merge pull request #80368 from danwinship/iptables-checks
iptables feature detection improvements
2019-08-22 13:31:20 -07:00
liuxu
c90b295ef1 don't delete KUBE-MARK-MASQ chain in iptables/ipvs proxier 2019-08-20 15:43:54 +08:00
Tim Hockin
5b14394f4e Don't track syncProxyRules runtime if not running 2019-08-16 17:05:03 -07:00
hui luo
a2ef00c1b1 Add iptables restore failure metrics
As mentioned in issue #80061, in iptables lock contention case,
we can see increasing rate of iptables restore failures because it
need to grab iptables file lock.

The failure metric can provide administrators more insight

Metrics will be collected in kube-proxy iptables and ipvs modes

Signed-off-by: Hui Luo <luoh@vmware.com>
2019-08-09 10:18:19 -07:00
Dan Winship
a735c97356 kube-proxy: drop iptables version check
Kube-proxy's iptables mode used to care whether utiliptables's
EnsureRule was able to use "iptables -C" or if it had to implement it
hackily using "iptables-save". But that became irrelevant when
kube-proxy was reimplemented using "iptables-restore", and no one ever
noticed. So remove that check.
2019-08-01 12:05:31 -04:00
Anish Ramasekar
2878270f5b
Fix golint failures in pkg/proxy
Review feedback - remove alias from imports

fix comments
2019-07-08 11:48:33 -07:00
Kubernetes Prow Robot
da0f51ffed
Merge pull request #78820 from haosdent/fix_typos
Fix typos.
2019-07-01 15:09:20 -07:00
Andrew Sy Kim
ba19451020 iptables proxier: fix comments for LB IP traffic from local address
Signed-off-by: Andrew Sy Kim <kiman@vmware.com>
2019-06-28 16:42:01 -04:00
Kubernetes Prow Robot
0c9964fac3
Merge pull request #76160 from JacobTanenbaum/BaseServiceInfo-cleanup
enforce the interface relationship between ServicePort and BaseServiceInfo
2019-06-13 20:37:13 -07:00
Haosdent Huang
7ce6e71891 Fix typos. 2019-06-11 01:52:14 +08:00
Jacob Tanenbaum
c0392d72e9 enforce the interface relationship between ServicePort and BaseServiceInfo
Currently the BaseServiceInfo struct implements the ServicePort interface, but
only uses that interface sometimes. All the elements of BaseServiceInfo are exported
and sometimes the interface is used to access them and othertimes not

I extended the ServicePort interface so that all relevent values can be accessed through
it and unexported all the elements of BaseServiceInfo
2019-06-05 14:50:24 -04:00
Kubernetes Prow Robot
bdf3d248eb
Merge pull request #77523 from andrewsykim/fix-xlb-from-local
iptables proxier: route local traffic to LB IPs to service chain
2019-05-31 12:22:53 -07:00
Kubernetes Prow Robot
929adb69e3
Merge pull request #76165 from JacobTanenbaum/minor-cleanups
Minor cleanups in pkg/proxy/endpoints.go
2019-05-15 22:55:55 -07:00