简体   繁体   English

kube-proxy负载平衡如何

[英]How does kube-proxy loadbalancing

I understand that nodes in K8s cluster will all have kube-proxy running and any node can forward traffic for any service in the cluster. 我知道K8s集群中的节点都将运行kube-proxy ,并且任何节点都可以转发集群中任何服务的流量。

Lets say I have a service with two replica pods which are running on two Nodes N1 and N2 . 可以说我有一个带有两个副本容器的服务,它们在两个节点N1N2上运行。 The external load balancer forwards traffic to N3 and N4 . 外部负载平衡器将流量转发到N3N4 The first request reaches N3 and N3 's kube-proxy diverts the traffic to N1 . 第一个请求到达N3N3kube-proxy将流量转移到N1 The second request reaches N4 and N4 's kube-proxy diverts the traffic to N2. 第二个请求到达N4N4kube-proxy将流量转移到N2。

Do kube-proxy s communicate with each other so that N4 's kube-proxy is aware that earlier request was forwarded to N1 and so it should divert this request to N2 for proper load balancing or the decision is local to that kube-proxy and not coordinated across kube-proxy in which case it doesn't correctly load balance ? kube-proxy是否kube-proxy通信,以便N4kube-proxy知道之前的请求已转发到N1 ,因此它应将此请求转移到N2以进行适当的负载平衡,或者该决定是该kube-proxy本地决定,并且跨kube-proxy无法协调,在这种情况下,负载平衡不正确?

每个kube-proxy实例分别进行负载平衡。

Kube-Proxy does not communicate with each other, they only talks to apiserver to get services and their endpoints information. Kube-Proxy不会相互通信,它们仅与apiserver以获取服务及其端点信息。

Load Balance is conducted separately on each kube-proxy . 在每个kube-proxy上分别进行负载均衡。 Since the default LB algorithm is random, there is no need to make things complicated. 由于默认的LB算法是随机的,因此无需复杂。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM