Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the Advantages of using Kubernetes Ingress in Azure AKS

My understanding is that setting the Service type to LoadBalancer creates a new Azure Load Balancer and assigns an IP address to the Service. Does this mean that I can have multiple Services using port 80? If the app behind my Service (an ASP.NET Core app) can handle TLS and HTTPS why shouldn't I just use LoadBalancer's for any Service I want to expose to the internet?

What is the advantage of using an Ingress if I don't care about TLS termination (You can let Cloudflare handle TLS termination)? If anything, it slows things down by adding an extra hop for every request.

Update

Some answers below mention that creating load balancers is costly. It should be noted that load balancers on Azure are free but they do charge for IP addresses of which they give you five for free. So for small projects where you want to expose up to five IP addresses, it's essentially free. Any more than that, then you may want to look ad usign Ingress.

Some answers also mention extra complexity if you don't use Ingress. I have already mentioned that Cloudflare can handle TLS termination for me. I've also discovered the external-dns Kubernetes project to create DNS entries in Cloudflare pointing at the load balancers IP address? It seems to me that cutting out Ingress reduces complexity as it's one less thing that I have to configure and manage. The choice of Ingress is also massive, it's likely that I'll pick the wrong one which will end up unmaintained after some time.

like image 966
Muhammad Rehan Saeed Avatar asked Nov 21 '18 15:11

Muhammad Rehan Saeed


People also ask

What is the purpose of using an ingress in Kubernetes?

The Ingress concept lets you map traffic to different backends based on rules you define via the Kubernetes API. An API object that manages external access to the services in a cluster, typically HTTP. Ingress may provide load balancing, SSL termination and name-based virtual hosting.

What is ingress for Kubernetes in Azure?

An ingress controller is a piece of software that provides reverse proxy, configurable traffic routing, and TLS termination for Kubernetes services. Kubernetes ingress resources are used to configure the ingress rules and routes for individual Kubernetes services.

Why would you prefer to use an ingress controller in a Kubernetes cloud?

The major advantage of using a cloud-based Ingress Controller is native integration with other cloud services. For instance, GCE Ingress Controller supports Cloud IAP for Google Kubernetes Engine to easily turn on Identity-Aware Proxy to protect internal K8s applications.

What are the benefits of using the application gateway ingress controller Agic in a Microsoft Azure Kubernetes service AKS cluster?

Benefits of Application Gateway Ingress Controller AGIC helps eliminate the need to have another load balancer/public IP in front of the AKS cluster and avoids multiple hops in your datapath before requests reach the AKS cluster.

What is the difference between ingress and ingress controller in Kubernetes?

Ingress controllers only cover L7 traffic, while ingresses route HTTP and HTTPS traffic. It is not possible to route TCP and UDP traffic using an Ingress, even if the ingress controller supports L4 traffic.


1 Answers

There is a nice article here which describe the differences on Service(Load Balancer) and Ingress.

In summary, you can have multiple Service(Load Balancer) in the cluster, where each application is exposed independently from each other. The main issue is that each Load Balancer added will increase the cost of your solution, and does not have to be this way, unless you strictly need this.

If multiple applications listen on port 80, and they are inside the container, there is no reason you also need to map it to the port 80 in the host node. You can assign it to any port, because the Service will handle the dynamic port mappings for you.

The ingress is best in this scenario, because you can have one ingress listing on port 80, and route the traffic to the right service based on many variables, like:

  • Domain
  • Url Path
  • Query String
  • And many other

Ingress in not just for TLS termination, it is in simple terms a proxy\gateway that will control the routing to the right service, TLS termination is just one of the features.

like image 124
Diego Mendes Avatar answered Nov 11 '22 12:11

Diego Mendes