Commit Graph

1250 Commits

Author SHA1 Message Date
lsytj0413
948a578179 refactor(*): fix comparison to bool constant, return redundant 2019-10-28 16:41:08 +08: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
Ricardo Pchevuzinske Katz
6aaae7d646 Add support for builtin modules in kube-proxy
Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@serpro.gov.br>
2019-10-23 13:59:44 -03:00
Kubernetes Prow Robot
bbe71214a6
Merge pull request #83677 from HotelsDotCom/kube-proxy-README
Bugfix kube-proxy README file to list ipvs modules, closes #83676
2019-10-21 21:11:51 -07:00
preisinger
d6431fbdfa Bugfix kube-proxy README file to list ipvs modules 2019-10-18 09:25:28 +01:00
Kubernetes Prow Robot
6a5f0e6eda
Merge pull request #81348 from yastij/code-org-service-controller
move service helpers to k8s.io/cloud-provider
2019-10-17 00:20:38 -07:00
Yassine TIJANI
d796baea27 move service helpers to k8s.io/cloud-provider
Signed-off-by: Yassine TIJANI <ytijani@vmware.com>
2019-10-16 14:12:11 +02:00
Kubernetes Prow Robot
bb6166419a
Merge pull request #83644 from danwinship/userspace-proxy-logging
Don't log about deleting non-existent affinity entries in userspace OnEndpointsAdd
2019-10-15 23:05:38 -07:00
Kubernetes Prow Robot
a7b3114c88
Merge pull request #83553 from rikatz/issue77493-part1
Improve IPVS Module loader logic
2019-10-15 23:05:13 -07: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
8e7de45034
Reworking kube-proxy to only compute endpointChanges on apply.
Computing EndpointChanges is a relatively expensive operation for
kube-proxy when Endpoint Slices are used. This had been computed on
every EndpointSlice update which became quite inefficient at high levels
of scale when multiple EndpointSlice update events would be triggered
before a syncProxyRules call.

Profiling results showed that computing this on each update could
consume ~80% of total kube-proxy CPU utilization at high levels of
scale. This change reduced that to as little as 3% of total kube-proxy
utilization at high levels of scale.

It's worth noting that the difference is minimal when there is a 1:1
relationship between EndpointSlice updates and proxier syncs. This is
primarily beneficial when there are many EndpointSlice updates between
proxier sync loops.
2019-10-15 16:31:12 -07:00
Ricardo Pchevuzinske Katz
da8931560b Improve IPVS Module loader logic
Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@serpro.gov.br>
2019-10-11 08:59:41 -03:00
Kubernetes Prow Robot
0ff761b14f
Merge pull request #82927 from obitech/kube_proxy_strict_serializer
Enable strict serializer in kube-proxy
2019-10-09 11:05:50 -07:00
Dan Winship
ebe94f139a Don't log about deleting non-existent affinity entries in userspace OnEndpointsAdd 2019-10-08 18:17:41 -04: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
Kubernetes Prow Robot
35d68586db
Merge pull request #83208 from robscott/endpointslice-proxy-staleconn-perf
Only detecting stale connections for UDP ports in kube-proxy
2019-10-02 23:40:08 -07:00
Kubernetes Prow Robot
74d2822662
Merge pull request #72535 from tallclair/content-type
Always set content-type & nosniff
2019-09-27 18:43:39 -07:00
Rob Scott
af56f25797
Only detecting stale connections for UDP ports in kube-proxy.
The detectStaleConnections function in kube-proxy is very expensive in
terms of CPU utilization. The results of this function are only actually
used for UDP ports. This adds a protocol attribute to ServicePortName to
make it simple to only run this function for UDP connections. For
clusters with primarily TCP connections this can improve kube-proxy
performance by 2x.
2019-09-25 17:48:54 -07:00
Rob Scott
d4b694a497
Updating EndpointSliceCache sort function to be significantly faster.
The .IP() call that was previously used for sorting resulted in a call
to netutil to parse an IP out of an IP:Port string. This was very slow
and resulted in this sort taking up ~50% of total CPU util for
kube-proxy.
2019-09-23 17:12:54 -07:00
obitech
f9b152abb0 Add strict serializer to codec factory in kube-proxy 2019-09-23 19:39:00 +02:00
danielqsj
c2a4906152 Bump k8s.io/klog to v1.0.0 2019-09-23 16:51:43 +08:00
hwdef
4e7ef9ad36 delete unused var 2019-09-19 18:04:13 +08:00
Kubernetes Prow Robot
e7090e8f5e
Merge pull request #81517 from danwinship/iptables-monitor
drop firewalld monitoring, add better iptables monitor
2019-09-17 10:58:02 -07: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
9da6c6fe98
Merge pull request #82736 from RainbowMango/pr_migrate_prom_bucket_for_proxy_metrics
Migrate prometheus bucket functionality to kube-metrics for proxy metrics
2019-09-16 23:16:36 -07:00
RainbowMango
d36c27a106 Update bazel by hack/update-bazel.sh 2019-09-16 11:07:05 +08:00
RainbowMango
4ba8a9fee1 Migrate prometheus bucket functionality to metrics stability framework. 2019-09-16 11:05:38 +08:00
RainbowMango
e9c5b06b79 Update bazel by hack/update-bazel.sh 2019-09-16 10:36:20 +08:00
RainbowMango
fba9c76114 Migrate prometheus bucket functionality to metrics stability framework. 2019-09-16 10:34:58 +08:00
Kubernetes Prow Robot
fae7aa78a3
Merge pull request #82317 from viviyww/master11
Repaire incorrect ip version event
2019-09-11 15:25:39 -07:00
Kubernetes Prow Robot
2a749f1e88
Merge pull request #82307 from yutedz/rm-proxy-locked
Remove unused func IsProxyLocked
2019-09-11 15:25:15 -07:00
Tim Allclair
ef6cba0b36 Always set content-type & nosniff 2019-09-11 15:01:43 -07:00
Rob Scott
a1e3afa28e
Adding a nil check in endpointslicecache 2019-09-05 17:32:44 -07: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
yangweiwei
99430f51fd Repaire incorrect ip version event
When we config the wrong ip version and the endpoint updates the
error event info. But the parameter call order is wrong. So we should
fix it.
2019-09-04 15:15:59 +08:00
Ted Yu
6e0878fbcc Remove unused func IsProxyLocked 2019-09-04 10:36:24 +08:00
Kubernetes Prow Robot
f71cfdf66d
Merge pull request #82214 from Nordix/issue-80462
Ensure the KUBE-MARK-DROP chain in kube-proxy mode=ipvs
2019-09-03 16:01:37 -07:00
Kubernetes Prow Robot
542f3c65a0
Merge pull request #78547 from MikeSpreitzer/fix-76699
Make iptables and ipvs modes of kube-proxy MASQUERADE --random-fully if possible
2019-09-03 14:34:58 -07:00
Lars Ekman
9e6a687352 Ensure the KUBE-MARK-DROP chain in kube-proxy mode=ipvs 2019-09-03 21:08:54 +02: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
Khaled Henidak(Kal)
ef75723564 ipvs dualstack: generated items
co-authored-by: Lars Ekman <lars.g.ekman@est.tech>
2019-08-29 23:38:25 +00:00
Khaled Henidak(Kal)
465255425e create meta-proxy for proxy-mode=ipvs (dualstack)
co-authored-by: Lars Ekman <lars.g.ekman@est.tech>
2019-08-29 23:37:37 +00: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
Kubernetes Prow Robot
7d241f0ec1
Merge pull request #81626 from logicalhan/proxy-migration
migrate kube-proxy metrics to stability framework
2019-08-29 05:30:23 -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
bd8a8db515
Merge pull request #81477 from paulsubrata55/kube-proxy-sctp-ipset-fix
Fix in kube-proxy for sctp ipset entries
2019-08-28 18:26:09 -07:00
Kubernetes Prow Robot
af54eae69a
Merge pull request #81612 from rikatz/issue81060
Remove watching Endpoints of Headless Services
2019-08-28 14:44:25 -07:00
Han Kang
e1bf0b4918 group imports properly 2019-08-28 12:49:54 -07:00
Han Kang
0895ac212d migrate kube-proxy metrics to stability framework 2019-08-28 12:49:54 -07:00
Kubernetes Prow Robot
927f45191e
Merge pull request #81527 from yastij/move-controller-util
move WaitForCacheSync to the sharedInformer package
2019-08-27 00:52:54 -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
Yassine TIJANI
7e4c3096fe move WaitForCacheSync to the sharedInformer package
Signed-off-by: Yassine TIJANI <ytijani@vmware.com>
2019-08-22 16:13:41 +01:00
Ricardo Pchevuzinske Katz
e389237171 Remove watching Endpoints of Headless Services
Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@serpro.gov.br>
2019-08-21 16:37:09 -03:00
Yassine TIJANI
4d9e4f0b45 move ShuffleStrings to pkg/proxy
Signed-off-by: Yassine TIJANI <ytijani@vmware.com>
2019-08-21 20:03:53 +01:00
liuxu
c90b295ef1 don't delete KUBE-MARK-MASQ chain in iptables/ipvs proxier 2019-08-20 15:43:54 +08:00
Subrata Paul
138b8b8aaa Fix in kube-proxy for sctp ipset entries
Kube-proxy will add ipset entries for all node ips for an SCTP nodeport service. This will solve the problem 'SCTP nodeport service is not working for all IPs present in the node when ipvs is enabled. It is working only for node's InternalIP.'
2019-08-18 00:40:27 +05:30
Kubernetes Prow Robot
d21822a02a
Merge pull request #81538 from thockin/master
Don't track syncProxyRules runtime if not running
2019-08-17 09:24:06 -07:00
Tim Hockin
5b14394f4e Don't track syncProxyRules runtime if not running 2019-08-16 17:05:03 -07:00
Kubernetes Prow Robot
e6d4273395
Merge pull request #79033 from Nordix/kubeadm-ds-pod-network-cidr
Dual-Stack Integration with Kubeadm
2019-08-16 05:06:31 -07:00
Kubernetes Prow Robot
47e78f3de5
Merge pull request #81378 from tedyu/ports-2-endpt
buildPortsToEndpointsMap should use flattened value type
2019-08-15 19:17:01 -07:00
Ted Yu
2f671340c9 buildPortsToEndpointsMap should use flattened value type 2019-08-15 11:28:09 -07:00
Kubernetes Prow Robot
e552806753
Merge pull request #81361 from oxddr/kubeproxy-moar-logging
kube-proxy: do not export network programming latency for deleted Endpoints
2019-08-14 16:52:49 -07:00
Kubernetes Prow Robot
4ac9701370
Merge pull request #81309 from andrewsykim/ipvs-test-delete-with-realserver
proxy/ipvs: test cleanLegacyService with real servers
2019-08-14 12:46:24 -07:00
Janek Łukaszewicz
e52110edcd kube-proxy: do not export network programming latency for deleted enpoints. 2019-08-14 14:00:07 +02:00
Kubernetes Prow Robot
8c7244ac12
Merge pull request #81312 from andrewsykim/ipvs-remove-const
proxy/ipvs: remove unused constant rsGracefulDeletePeriod
2019-08-13 19:37:16 -07:00
Andrew Sy Kim
459bfb1ab7 proxy/ipvs: test cleanLegacyService with real servers
Signed-off-by: Andrew Sy Kim <kiman@vmware.com>
2019-08-13 11:55:16 -04:00
Kubernetes Prow Robot
6d921c0eb5
Merge pull request #80779 from andrewsykim/ipvs-test-tables
proxy/ipvs: refactor IPVS unit tests TestClusterIP and TestNodePort to use test tables
2019-08-13 07:55:42 -07:00
Kubernetes Prow Robot
12a085f917
Merge pull request #80942 from gongguan/fix_ipvs_svc_del
fix ipvs_svc deletion
2019-08-13 02:27:54 -07:00
Andrew Sy Kim
e198eefa2b proxy/ipvs: remove unused constant rsGracefulDeletePeriod
Signed-off-by: Andrew Sy Kim <kiman@vmware.com>
2019-08-12 16:30:28 -04:00
ethan
94efd3fcdf
cleanup: proxier.go error message fix 2019-08-12 22:36:16 +08:00
louisssgong
97c4edaa4f Fix a bug in the IPVS proxier where virtual servers are not cleaned up even though the corresponding Service object was deleted. 2019-08-10 06:32:38 +08: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
Arvinderpal Wander
ec77598906 Update kubeproxy config validation to support list of comma
separated pod CIDRs. Dual-stack feature must be enabled for the
validation to be done.
2019-08-09 07:20:39 -07:00
Kubernetes Prow Robot
19e85a9092
Merge pull request #80502 from xigang/master
Update CleanupAndExit and OnServiceSynced field comment and bugfix panic params in the construct method
2019-08-07 20:10:06 -07:00
Kubernetes Prow Robot
695190da6b
Merge pull request #80218 from oxddr/kubeproxy-buckets
kube-proxy: change buckets used by NetworkProgrammingLatency
2019-08-04 08:33:49 -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
Emrecan BATI
90ce2d50d3 Add GetKernelVersion to ipvs.KernelHandler interface
ipvs `getProxyMode` test fails on mac as `utilipvs.GetRequiredIPVSMods`
try to reach `/proc/sys/kernel/osrelease` to find version of the running
linux kernel. Linux kernel version is used to determine the list of required
kernel modules for ipvs.

Logic to determine kernel version is moved to GetKernelVersion
method in LinuxKernelHandler which implements ipvs.KernelHandler.
Mock KernelHandler is used in the test cases.

Read and parse file is converted to go function instead of execing cut.
2019-07-31 22:10:44 +03:00
Andrew Sy Kim
089e0cd9ef proxy/ipvs: refactor TestNodePort to use test tables
Signed-off-by: Andrew Sy Kim <kiman@vmware.com>
2019-07-30 22:04:52 -04:00
Andrew Sy Kim
9af797c51e proxy/ipvs: refactor TestClusterIP to use test tables
Signed-off-by: Andrew Sy Kim <kiman@vmware.com>
2019-07-30 21:30:52 -04:00
silenceshell
c31a2b7076
kube-proxy in ipvs mode use ipvs to redirect traffic
fix the comment.
2019-07-28 21:36:02 +08:00
Janek Łukaszewicz
f9b683532a second iteration 2019-07-26 14:44:55 +02:00
xigang
4ac81d7508 Update the CleanupAndExit field for the Options and the OnServiceSynced for the ServiceHandler comment 2019-07-24 09:40:29 +08:00
Cezar Sa Espinola
c25763e159
proxy/ipvs: Compute all node ips only once when a zero cidr is used
Computing all node ips twice would always happen when no node port
addresses were explicitly set. The GetNodeAddresses call would return
two zero cidrs (ipv4 and ipv6) and we would then retrieve all node IPs
twice because the loop wouldn't break after the first time.

Also, it is possible for the user to set explicit node port addresses
including both a zero and a non-zero cidr, but this wouldn't make sense
for nodeIPs since the zero cidr would already cause nodeIPs to include
all IPs on the node.
2019-07-23 13:35:37 -03:00
Cezar Sa Espinola
5c16940508
proxy/ipvs: Only compute node ip addresses once per sync
Previously the same ip addresses would be computed for each nodePort
service and this could be CPU intensive for a large number of nodePort
services with a large number of ipaddresses on the node.
2019-07-23 13:35:27 -03:00
Janek Łukaszewicz
1dda3d8dfc kube-proxy: change buckets used by NetworkProgrammingLatency
refs https://github.com/kubernetes/perf-tests/issues/640

We have too fine buckets granularity for lower latencies, at cost of the higher
latecies (7+ minutes). This is causing spikes in SLI calculated based on that
metrics.

I don't have strong opinion about actual values - those seemed to be better
matching our need. But let's have discussion about them.

Values:

0.015 s
0.030 s
0.060 s
0.120 s
0.240 s
0.480 s
0.960 s
1.920 s
3.840 s
7.680 s
15.360 s
30.720 s
61.440 s
122.880 s
245.760 s
491.520 s
983.040 s
1966.080 s
3932.160 s
7864.320 s
2019-07-16 16:43:19 +02:00
Andrew Sy Kim
7aa1700dba proxy/ipvs: increase log level for graceful termination
Signed-off-by: Andrew Sy Kim <kiman@vmware.com>
2019-07-12 15:17:42 -04:00
Andrew Sy Kim
3629ed10fa add myself and lbernail as IPVS approvers
Signed-off-by: Andrew Sy Kim <kiman@vmware.com>
2019-07-11 19:06:59 -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
Andrew Sy Kim
22832cfb78 ipvs proxy: add unit test for udp graceful termination
Signed-off-by: Andrew Sy Kim <kiman@vmware.com>
2019-06-22 21:07:40 -04:00
Kubernetes Prow Robot
eee3e976d8
Merge pull request #78294 from vllry/kp-remove-resource-container
Remove deprecated flag --resource-container from kube-proxy
2019-06-22 00:38:12 -07:00