简体   繁体   English

如何为 Pod 之间的平衡请求设置 kube-proxy?

[英]How setup kube-proxy for balance requests between Pods?

I have a k8s cluster with 2 nodes.我有一个带有 2 个节点的 k8s 集群。 I have a ClusterIP Service with a Deployment linked to a HPA that autoscale a group of Pods.我有一个 ClusterIP 服务,其 Deployment 链接到一个自动扩展一组 Pod 的 HPA。 I would like to send many requests in multiple threads to the service and balance the requests in the current number of Pods available in that moment.我想在多个线程中向服务发送许多请求,并在当前可用的 Pod 数量中平衡请求。 At starting i was using the default kube-proxy mode IPTABLES but was RANDOM assigning the requests to Pods with some Pods working more and others less, increasing the response time of requests and having a not high percentage in average of CPU for add new pods.在开始时,我使用默认的 kube-proxy 模式 IPTABLES,但是将请求随机分配给 Pod,一些 Pod 工作更多而另一些工作更少,增加了请求的响应时间,并且平均 CPU 百分比不高用于添加新 Pod。 Than I switched to IPVS with "sed" scheduler but was not balancing the same because every thread was assigned to a Pod and working at max while last created Pods where not working.比我使用“sed”调度程序切换到 IPVS 但没有平衡相同,因为每个线程都分配给一个 Pod 并且在最后创建的 Pod 不工作的情况下以最大值工作。 Could you give me some hints of how can I reach my goal?你能给我一些提示,告诉我如何才能达到我的目标吗?

Kube-proxy does not support virtual IPs as a destination Every node in a Kubernetes cluster runs a kube-proxy. Kube-proxy 不支持将虚拟 IP 作为目标 Kubernetes 集群中的每个节点都运行 kube-proxy。 kube-proxy is responsible for implementing a form of virtual IP for Services of type other than ExternalName kube-proxy can run in three different modes: kube-proxy 负责实现一种虚拟 IP 的形式,用于 ExternalName 以外的类型的服务 kube-proxy 可以在三种不同的模式下运行:

  • iptables (default mode) iptables(默认模式)
  • Ipvs ipvs
  • userspace (“legacy” mode, not recommended anymore) While the iptables mode is totally fine for many clusters and workloads, ipvs can be useful when the number of services is important (more than 1,000).用户空间(“传统”模式,不再推荐) 虽然 iptables 模式对于许多集群和工作负载来说完全没问题,但当服务数量很重要(超过 1,000 个)时,ipvs 会很有用。 Indeed, as iptables rules are read sequentially, its usage can impact the routing performances if many services exist in the cluster.事实上,由于 iptables 规则是按顺序读取的,如果集群中存在许多服务,它的使用会影响路由性能。 You can look at thisdocument for the configuration.您可以查看此文档以了解配置。

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

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