Kubernetes使用哪种算法来导航副本集/部署中的流量

问题描述 投票:1回答:1

我被问到这个问题,而且我无法在网上找到有关它的信息 - Kubernetes使用哪种算法来控制pods的复制或部署中的流量(我猜它们是相同的)?

可以说,我在我的Kubernetes集群中有5个pod的副本,在replicaset中定义。群集如何在新请求中选择要转到哪个pod?它是否使用循环法?我找不到有关它的信息。

kubernetes replicaset kubernetes-deployment
1个回答
6
投票

应用于确定哪个pod将处理请求的算法取决于正在运行的kube-proxy模式。

  • 在1.0中,代理工作在称为用户空间的模式中,默认算法是循环法。
  • 在1.2模式下,添加了iptables代理,但由于iptables限制,仍然使用循环法。
  • 在1.8.0-beta中,引入了IP虚拟服务器(IPVS),它允许更多的算法选项,例如: ROUNDROBIN; WeightedRoundRobin; LeastConnection; WeightedLeastConnection; LocalityBasedLeastConnection; LocalityBasedLeastConnectionWithReplication; SourceHashing; DestinationHashing; ShortestExpectedDelay; NeverQueue。

参考文献:

https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies https://sookocheff.com/post/kubernetes/understanding-kubernetes-networking-model/

© www.soinside.com 2019 - 2024. All rights reserved.