Question is similar to following SO question. But I am not looking forward to create classic load balancer.
How to create Kubernetes load balancer on aws
AWS now provide 2 types of loadbalancer, classic load balancer and application load balancer. Please read following document for more information,
https://aws.amazon.com/blogs/aws/new-aws-application-load-balancer/
I already know how classic load balancer work with kubernetes. I wonder if there is any flag/ tool exist so that we can also configure application loadbalancer.
An AWS ALB Ingress Controller has been built which you can find on GitHub: https://github.com/coreos/alb-ingress-controller
I can tell you that as of K8 v1.2.3/4 there is no built-in support for Application Load Balancers.
That said, what I do is expose internally load balanced pods via a service NodePort. You can then implement any type of AWS load balancing you would like, including new Application Load Balancing features such as Content-Based Routing, by setting up your own AWS ALB that directs a URL path like /blog to a specific NodePort.
You can read more about NodePorts here: http://kubernetes.io/docs/user-guide/services/#type-nodeport
For bonus points, you could script the creation of the ALB via something like BOTO3 and have it provisioned when you provision the K8 services/pods/rc.
Related
When creating a Kubernetes service of type LoadBalancer on an EKS cluster, a load balancer is automatically provisioned by the AWS Load Balancer Controller.
For specific reasons, I'd like to have more control over the configuration of the load balancer than what is provided by the AWS Load Balancer service annotations.
Question: I'd like to know if it's possible to create the load balancer before the Kubernetes service (say in Terraform), and configure the Kubernetes service to use the load balancer (for example by providing the AWS Load Balancer Controller with the load balancer name).
Some research: I found the service annotation service.beta.kubernetes.io/aws-load-balancer-name, but it seems to be used to create a load balancer with the specified name, rather than find and use an existing load balancer with the specified name.
I was using AWS ECS fargate for running my application. I am migrating to AWS EKS. When I use ECS, I deployed a ALB to route request to my service in ECS cluster.
In kubernete, I read this doc https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer, it seems that Kubernete itself has a loadbalance service. And it seems that it creates an external hostname and IP address.
so my question is do I need to deploy AWS ALB? If no, how can I pub this auto-generated hostname in route53? Does it change if I redeploy the service?
Yes you need it to create Kubernetes Ingress using AWS ALB Ingress Controller, the following link explain how use ALB as Ingress controller in EKS: This
You don't strictly need an AWS ALB for apps in your EKS cluster, but you probably want it.
When adopting Kubernetes, it is handy to manage some infrastructure parts from the Kubernetes cluster in a similar way to how you mange apps and in some cases there are a tight coupling between the app and configuration of your load balancer, therefore it makes sense to manage the infrastructure the same way.
A Kubernetes Service of type LoadBalancer corresponds to a network load balancer (also known as L4 load balancer). There is also Kubernetes Ingress that corresponds to an application load balancer (also known as L7 load balancer).
To use an ALB or Ingress in Kubernetes, you also need to install an Ingress Controller. For AWS you should install AWS Load Balancer Controller, this controller now also provides features in case you want to use a network load balancer, e.g. by using IP-mode or expose services using an Elastic IP. Using a pre-configured IP should help with using Route53.
See the EKS docs about EKS network load balancing and EKS application load balancing
As already mentioned from the other guys, yes it is NOT required but it is very helpful to use an ALB.
There are a couple of different solutions to that.. my favorite solution is
Use an Ingress Controller like the ingress-nginx (there are multiple different Ingress Controllers available for Kubernetes, a very good comparison is provided here
Configure the IngressController Service to use NodePort and use a port like 30080
Create an own AWS ALB with Terraform for an example and add the NodePort 30080 to the TargetGroup
Create a Ingress resource to configure the IngressController
If you still have some questions, just ask them here :)
No you don't need ALB and yes, you can use Route53 in an automated manner. Here's a nice article that describes the latter:
https://www.padok.fr/en/blog/external-dns-route53-eks
I need some help configuring my load balancer for my Kubernetes clusters. The internal load balancer works fine. Now, I'd like to expose the service via https and I'm stumped on the Ingress configuration.
First of all, please take in count that whenever any HTTP(S) load balancer is configured through Ingress, you must not manually change or update the configuration of the HTTP(S) load balancer. That is, you must not edit any of the load balancer's components, including target proxies, URL maps, and backend services. Any changes that you make are overwritten by GKE.
So, once that we are aware about the above, We have to know that Ingress for Internal HTTP(S) Load Balancing deploys the Google Cloud Internal HTTP(S) Load Balancer. This private pool of load balancers is deployed in your network and provides internal load balancing for clients and backends within your VPC. As per this documentation.
Now, we are ready to configure an Ingress for Internal Load Balancer, This is an example about how to configure a simple Ingress in order to expose a simple service.
My suggestion is to try first to implement the first configuration in order to know how an ingress works, and then, try to configure an ingress for GKE as per this documentation.
Let me know if you still having doubts about it or if you need more assistance.
Have a nice day, and stay safe.
I am trying to implement CI/CD pipeline for my set of microservices by using Kubernetes HA cluster and Jenkins.
When I am exploring, I found that usage of load balancer for making a HA kubernetes cluster. I am planning to host my application in AWS. So I want to create and use an AWS elastic load balancer for my application by supporting HA kubernetes cluster.
My doubt here that, When I am exploring AWS load balancer, I am seeing that "Application Loadbalancer - http/https" and "Network Loadbalancer-TCP".
So here I am confused about which load balancer AWS resources I need to create? In my exploration, I understood that to create a network load balancer.
So my confusion is this. Can anyone clear that I am going in correct direction? Means creating network load balancer.
Can anyone correct me if I am going in wrong direction?
Let me know that should network load balancer will solve HA kubernetes cluster formation or not?
There isn't a right answer to your question, it really depends what you need to do. You can achieve HA with a network load balancer, a classic load balancer (even though this is the old generation and is not suggested) or an application load balancer.
The advantages of network load balancers are certainly related to performance and the possibility to attach elastic IPs and are ideal for balancing TPC traffic (level 4 routing).
On the other side, application load balancers are ideal for advanced load balancing of HTTP and HTTPS traffic (level 7 routing), with the possibility to do advanced request routing, suitable for complex application architectures (such as microservices)
This link might be useful https://aws.amazon.com/elasticloadbalancing/details/#details
We've currently got a production application using Kubernetes on AWS. Everything's working very well except I think we've made a misconfiguration problem.
We expose different services from within the cluster on domain names and we're now up to about 5 different services. Kubernetes' standard way to expose these services is through load balancers, but in our config we've created 6 load balancers. As you can imagine that many load balancers running can incur substantial cost overheads.
Is there any way to configure an individual load balancer to route to kubernetes targets based on domain names? So we can have one domain pointing at an ELB and have that route to the correct services internally?
You can use Ingress controller. Ingress will setup a single AWS load balancer and can be used to expose many services. If you services are all HTTP based, it should work quite well. For more information about ingress you can have a look to the Kubernetes docs or at the default Nginx based implementation. If needed there are also some other implementations using for example Envoy proxy etc.