简体   繁体   中英

Use of load balancer infront of ingress nginx controller

I am having hard time in understanding the role of a Load Balancer when used with Ingress Nginx.

I know a Load balancer distributes request over multiple nodes.

ig, let's say I have two nodes A and B, and they are responisble for processing requests at example.com .

So a load balancer will take request for example.com and distribute among them with help of defined algorithm.

I also understand what an API Gateway is,

ig, let's say I have one order service and another payment service so an API gateway will get the request for example.com and it will hand over the request for /orders to order service and /payments to payment service.

The Confusion:

Load Balancer(NLB) -> API Gateway -> Services -> order deployment -> which is running two replicas
  1. Who distributes requests in those replicas for /orders
  2. What is the role of load balancer in this case?
  3. Some article suggest to create a service as type Load Balancer what does that mean? What this service will do?
  4. Also, Load Balancer sits outside of the cluster NLB -> [ k8s cluster ] , how does it know how to distribute requests?

These collectely could one question, I don't know.

Any kind of explanation would appreciated.

I have gone through many articles and blogs but none talks about complete picture.

Update

Many of my doubts are cleared through this article

Within the cluster a service does load balancing among the replicas. Source

I still have some questions,

Do I only need a load balacner to expose the ingress controller service?

What if there is some problem with the ingress controller and it restarts.

What will happen will it get a new IP and load balancer will poin to new one or the ip will remain the same?

This article may help: https://aws.amazon.com/blogs/opensource/network-load-balancer-nginx-ingress-controller-eks/

Q: Do I only need a load balacner to expose the ingress controller service? A: Expose K8s services mainly

Q: What if there is some problem with the ingress controller and it restarts. A: Problem can appear if new broken changes will be applied, and in this case old controller will still work, but new one will fail to start, therefore you will have to do kubectl describe etc, to understand what is wrong.

Q: What will happen will it get a new IP and load balancer will poin to new one or the ip will remain the same? A: Why you need LB ip's? Use LoadBalancer DNS.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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