Commit Graph

362 Commits

Author SHA1 Message Date
Basant Amarkhed
8fb895f3f1 Updating after merging with a conflicting commit 2020-11-14 01:09:46 +00:00
Patrik Cyvoct
d29665cc17
Revert "Merge pull request #92312 from Sh4d1/kep_1860"
This reverts commit ef16faf409, reversing
changes made to 2343b8a68b.
2020-11-11 10:26:53 +01:00
Patrik Cyvoct
20fc86df25
fix defaulting
Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
2020-11-07 10:00:59 +01:00
Patrik Cyvoct
0768b45e7b
add nil case in proxy
Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
2020-11-07 10:00:58 +01:00
Patrik Cyvoct
540901779c
fix reviews
Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
2020-11-07 10:00:53 +01:00
Patrik Cyvoct
0153b96ab8
fix review
Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
2020-11-07 10:00:27 +01:00
Patrik Cyvoct
47ae7cbf52
Add route type field to loadbalancer status ingress
Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
2020-11-07 09:59:58 +01:00
Kubernetes Prow Robot
48a2bca893
Merge pull request #96251 from ravens/nodeport_udp_conntrack_fix
Correctly fix clearing conntrack entry on endpoint changes (nodeport)
2020-11-06 14:25:37 -08:00
Kubernetes Prow Robot
0451848d64
Merge pull request #95787 from qingsenLi/k8s201022-format
format incorrectAddresses in klog
2020-11-05 11:50:33 -08:00
Yan Grunenberger
fdee7b2faa Correctly fix clearing conntrack entry on endpoint changes (nodeport)
A previous PR (#71573) intended to clear conntrack entry on endpoint
changes when using nodeport by introducing a dedicated function to
remove the stale conntrack entry on the node port and allow traffic to
resume. By doing so, it has introduced a nodeport specific bug where the
conntrack entries related to the ClusterIP does not get clean if
endpoint is changed (issue #96174). We fix by doing ClusterIP cleanup in
all cases.
2020-11-05 09:45:17 +01:00
Khaled Henidak (Kal)
6675eba3ef
dual stack services (#91824)
* api: structure change

* api: defaulting, conversion, and validation

* [FIX] validation: auto remove second ip/family when service changes to SingleStack

* [FIX] api: defaulting, conversion, and validation

* api-server: clusterIPs alloc, printers, storage and strategy

* [FIX] clusterIPs default on read

* alloc: auto remove second ip/family when service changes to SingleStack

* api-server: repair loop handling for clusterIPs

* api-server: force kubernetes default service into single stack

* api-server: tie dualstack feature flag with endpoint feature flag

* controller-manager: feature flag, endpoint, and endpointSlice controllers handling multi family service

* [FIX] controller-manager: feature flag, endpoint, and endpointSlicecontrollers handling multi family service

* kube-proxy: feature-flag, utils, proxier, and meta proxier

* [FIX] kubeproxy: call both proxier at the same time

* kubenet: remove forced pod IP sorting

* kubectl: modify describe to include ClusterIPs, IPFamilies, and IPFamilyPolicy

* e2e: fix tests that depends on IPFamily field AND add dual stack tests

* e2e: fix expected error message for ClusterIP immutability

* add integration tests for dualstack

the third phase of dual stack is a very complex change in the API,
basically it introduces Dual Stack services. Main changes are:

- It pluralizes the Service IPFamily field to IPFamilies,
and removes the singular field.
- It introduces a new field IPFamilyPolicyType that can take
3 values to express the "dual-stack(mad)ness" of the cluster:
SingleStack, PreferDualStack and RequireDualStack
- It pluralizes ClusterIP to ClusterIPs.

The goal is to add coverage to the services API operations,
taking into account the 6 different modes a cluster can have:

- single stack: IP4 or IPv6 (as of today)
- dual stack: IPv4 only, IPv6 only, IPv4 - IPv6, IPv6 - IPv4

* [FIX] add integration tests for dualstack

* generated data

* generated files

Co-authored-by: Antonio Ojea <aojea@redhat.com>
2020-10-26 13:15:59 -07:00
Kubernetes Prow Robot
766ae2b81b
Merge pull request #95252 from tssurya/shrink-input-chain
Kube-proxy: Perf-fix: Shrink INPUT chain
2020-10-22 22:16:02 -07:00
qingsenLi
9ad39c9eda format incorrectAddresses in klog 2020-10-22 17:26:29 +08:00
Surya Seetharaman
477b14b3c4 Kube-proxy: Perf-fix: Shrink INPUT chain
In #56164, we had split the reject rules for non-ep existing services
into KUBE-EXTERNAL-SERVICES chain in order to avoid calling KUBE-SERVICES
from INPUT. However in #74394 KUBE-SERVICES was re-added into INPUT.

As noted in #56164, kernel is sensitive to the size of INPUT chain. This
patch refrains from calling the KUBE-SERVICES chain from INPUT and FORWARD,
instead adds the lb reject rule to the KUBE-EXTERNAL-SERVICES chain which will be
called from INPUT and FORWARD.
2020-10-19 11:26:04 +02:00
Antonio Ojea
880baa9f6f kube-proxy: log stale services operations 2020-10-19 09:35:34 +02:00
Lion-Wei
1f7ea16560 kube-proxy ensure KUBE-MARK-DROP exist but not modify their rules 2020-10-16 14:52:07 +08:00
Amim Knabben
a18e5de51a LockToDefault the ExternalPolicyForExternalIP feature gate 2020-09-16 13:16:33 -04:00
Rob Scott
c382c79f60
Updating kube-proxy to trim space from loadBalancerSourceRanges
Before this fix, a Service with a loadBalancerSourceRange value that
included a space would cause kube-proxy to crashloop. This updates
kube-proxy to trim any space from that field.
2020-08-20 18:19:52 -07:00
Vinod K L Swamy
4505d5b182
Changes to Proxy common code 2020-06-29 14:29:46 -07:00
Kubernetes Prow Robot
73fa63a86d
Merge pull request #92035 from danwinship/unmark-before-masq
kubelet, kube-proxy: unmark packets before masquerading them
2020-06-16 00:50:03 -07:00
Dan Winship
c12534d8b4 kubelet, kube-proxy: unmark packets before masquerading them
It seems that if you set the packet mark on a packet and then route
that packet through a kernel VXLAN interface, the VXLAN-encapsulated
packet will still have the mark from the original packet. Since our
NAT rules are based on the packet mark, this was causing us to
double-NAT some packets, which then triggered a kernel checksumming
bug. But even without the checksum bug, there are reasons to avoid
double-NATting, so fix the rules to unmark the packets before
masquerading them.
2020-06-15 18:45:38 -04:00
Kubernetes Prow Robot
35fc65dc2c
Merge pull request #89998 from Nordix/issue-89923
Filter nodePortAddresses to proxiers
2020-06-13 09:39:55 -07:00
Kubernetes Prow Robot
8f5e8514b3
Merge pull request #90103 from SataQiu/refactor-proxy-20200413
kube-proxy: move GetNodeAddresses call out of internal loop to avoid repeated computation
2020-06-02 19:44:17 -07:00
SataQiu
b68312e688 kube-proxy: move GetNodeAddresses call out of internal loop to avoid repeated computation
Signed-off-by: SataQiu <1527062125@qq.com>
2020-05-26 15:32:05 +08:00
Davanum Srinivas
442a69c3bd
switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-16 07:54:27 -04:00
Lars Ekman
f54b8f98b9 Filter nodePortAddresses to the proxiers.
Log a warning for addresses of wrong family.
2020-05-15 09:54:33 +02:00
Casey Callendrello
042daa24ac proxy: followup to last-queued-change metric
Fixes two small issues with the metric added in #90175:

1. Bump the timestamp on initial informer sync. Otherwise it remains 0 if
   restarting kube-proxy in a quiescent cluster, which isn't quite right.
2. Bump the timestamp even if no healthz server is specified.
2020-05-11 18:48:47 +02:00
Casey Callendrello
2e1a884bf3 pkg/proxy: add last-queued-timestamp metric
This adds a metric, kubeproxy_sync_proxy_rules_last_queued_timestamp,
that captures the last time a change was queued to be applied to the
proxy. This matches the healthz logic, which fails if a pending change
is stale.

This allows us to write alerts that mirror healthz.

Signed-off-by: Casey Callendrello <cdc@redhat.com>
2020-04-21 15:19:32 +02:00
Tim Hockin
efb24d44c6 Rename iptables IsIpv6 to IsIPv6 2020-04-10 15:29:50 -07:00
Tim Hockin
ef934a2c5e Add Protocol() method to iptables
Enables simpler printing of which IP family the iptables interface is
managing.
2020-04-10 15:29:49 -07:00
Tim Hockin
b874f7c626 Encapsulate sysctl test and log 2020-04-10 15:29:49 -07:00
Tim Hockin
37da906db2 kube-proxy: more logging at startup 2020-04-10 15:17:46 -07:00
Kubernetes Prow Robot
4a63d95916
Merge pull request #89792 from andrewsykim/remove-redundant-len-check
proxy: remove redundant length check on local address sets
2020-04-10 00:31:47 -07:00
Andrew Sy Kim
5169ef5fb5 proxy: remove redundant length check on local address set
Signed-off-by: Andrew Sy Kim <kim.andrewsy@gmail.com>
2020-04-02 16:06:51 -04:00
Kubernetes Prow Robot
bbe5594409
Merge pull request #89296 from danwinship/random-emptily
Don't log whether we're using iptables --random-fully
2020-04-02 12:42:24 -07:00
Kubernetes Prow Robot
c2ae0bd763
Merge pull request #74073 from Nordix/issue-70020
Issue #70020; Flush Conntrack entities for SCTP
2020-04-01 22:14:24 -07:00
Dan Winship
8edd656238 Don't log whether we're using iptables --random-fully 2020-03-20 08:06:27 -04:00
Kubernetes Prow Robot
1b3c94b034
Merge pull request #89146 from SataQiu/fix-kube-proxy-20200316
comment cleanup for kube-proxy
2020-03-18 22:25:05 -07:00
SataQiu
64a496e645 kube-proxy: some code cleanup 2020-03-17 21:46:54 +08:00
Minhan Xia
efc4b12186 add ExternalTrafficPolicy support for External IPs in iptables kubeproxy 2020-03-13 14:59:39 -07:00
Lars Ekman
aa8521df66 Issue #70020; Flush Conntrack entities for SCTP
Signed-off-by: Lars Ekman <lars.g.ekman@est.tech>
2020-03-11 09:56:54 +01:00
Satyadeep Musuvathy
8c6956e5bb Refactor handling of local traffic detection. 2020-02-21 17:57:34 -08:00
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