In today's article, I will show you how to install AWS LoadBalancer Controller on EKS cluster along with fixing some common issues. This controller help to manage Elastic Load Balancers for a Kubernetes cluster. Let's get started.
Before you start, we need following things:
An existing Amazon EKS cluster
Create IAM OIDC provider
Firstly, you need to create an IAM OIDC provider for your cluster, this helps to verify the identity of the End-User based on the authentication performed by an Authorization Server. To do this, you need to run the following command:
Above command downloads the IAM Policy to the current directory.
Create IAM Policy for the ALB
Now we need to create the IAM Policy for the AWS Load Balancer Controller using the above downloaded JSON. To do this, you need to run the following command:
aws iam create-policy --policy-name AWSLoadBalancerControllerIAMPolicy --policy-document file://iam_policy.json
Create IAM Role & Service Account
Now we need to create an IAM Role and Service Account for the AWS Load Balancer Controller by attaching the policy we have created in our previous step. To do this, you need to run the following command:
Now we need to install the Target Group Binding CRDs. This Target Group Binding helps to expose our pods using Application Load Balancers & Network Load Balancers. To do this, you need to run the following command:
After few minutes, you can verify the ingress by running the following command:
kubectl get ingress/ingress-2048 -n game-2048
It will show your ingress details. You can copy the address and paste it in your browser. You will see the sample application running on the browser. You can get ingress from your AWS Management Console also, if you navigate to the EC2 dashboard and the select Load Balancers from the menu on the left-pane, you should see the details of the ALB instance created for your application.
In this tutorial, we have learned how to install AWS Load Balancer Controller in your EKS Cluster. For more details you can check the AWS Load Balancer Controller official documentation. You can obtain all the required script from this GitHub repository. If you have any issue regarding this tutorial, mention your issue in the comment section or reach me through my E-mail.