Kubernetes - Anyway to load balance requests to a service running on multiple nodes without an external load balancer?

喜欢而已 提交于 2019-12-11 12:57:28

问题


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.

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.

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.


回答1:


Take a look at Keepalived in Kubernetes.

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.



来源:https://stackoverflow.com/questions/46732208/kubernetes-anyway-to-load-balance-requests-to-a-service-running-on-multiple-no

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!