Kubernetes-无论如何在没有外部负载均衡器的情况下将请求负载均衡到在多个节点上运行的服务? [英] Kubernetes - Anyway to load balance requests to a service running on multiple nodes without an external load balancer?

查看:294
本文介绍了Kubernetes-无论如何在没有外部负载均衡器的情况下将请求负载均衡到在多个节点上运行的服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,在单个节点上运行并扩展运行多个Pod 的部署的效果很好,并且在使用类型为"nodePort"的服务公开时,可以很好地平衡对虚拟服务器的请求该单个节点上的多个Pod之间的IP.

So running and scaling a deployment running multiple pods on a single node works nicely, and when exposing the service with a type "nodePort" nicely balances requests to the virtual IP between the multiple pods on that individual node.

此后,我向集群中添加了一个附加节点,当使用nodePort公开服务,然后在2个节点上运行Pod时,我当然需要专门指定每个主机,以命中运行在不同节点上不同Pod中的端点

I've since added an additional node to my cluster, and when exposing the Service using nodePort and then running pods over 2 nodes, I of course need to specify each host specifically to hit the endpoints running in different pods on different nodes.

我想将请求发送到单个VIP,并在不同节点上实现负载平衡.我正在家庭网络上运行这个小型集群,所以我的问题是,是否仍然可以将请求发送到单个VIP,并在不使用外部负载均衡器的情况下在节点/吊舱之间实现负载均衡?例如,在kubernetes中是否有一些配置可以解决这个问题?

I would like to send requests to a single VIP and load balance accross the different nodes. I am running this small cluster on my home network, so my question is, is there anyway to send requests to a single VIP, and load balance across the nodes / pods without using an external load-balancer? E.g., is there some config within kubernetes to handle this?

我尝试使用服务类型的负载平衡器(而不是节点端口),但这并没有跨节点进行负载平衡.

I tried using a service type load balancer (instead of node port) but this didn't load balance accross nodes.

推荐答案

看看保留在Kubernetes中.

该想法是在外部向每个服务公开虚拟IP(VIP)地址 kubernetes集群的一部分. keepalived然后使用VRRP对此进行同步 在本地网络中映射".具有2个或更多Pod的实例 在集群中运行可以使用单个VIP提供HA 地址.

The idea is to expose a Virtual IP (VIP) address per service, outside of the kubernetes cluster. keepalived then uses VRRP to sync this "mapping" in the local network. With 2 or more instance of the pod running in the cluster is possible to provide HA using a single VIP address.

这篇关于Kubernetes-无论如何在没有外部负载均衡器的情况下将请求负载均衡到在多个节点上运行的服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆