Open In App

How to Set Up and Deploy the Application Load Balancer Controller

Last Updated : 01 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

If you're running applications on Kubernetes using Amazon EKS (Elastic Kubernetes Service), you need a way to efficiently distribute traffic across your services. The AWS Application Load Balancer Controller makes this process much easier by automatically managing the distribution of traffic to your applications, helping you scale seamlessly and ensure high availability.

This guide will walk you through the process of setting up and deploying the ALB Ingress Controller on your Kubernetes cluster. Whether you're new to Kubernetes or looking to optimize your cloud setup, this article will help you get started quickly and effectively.

What is the AWS Application Load Balancer Controller?

The AWS ALB Controller is a tool that helps Kubernetes clusters automatically manage AWS Application Load Balancers (ALBs). It acts as an Ingress Controller, meaning it helps route external traffic into your Kubernetes cluster based on defined rules.

Why is this important? When you have multiple services running in Kubernetes, you need a way to efficiently route traffic between them. The AWS ALB Controller automates that by configuring the ALB for you, saving time and ensuring your traffic flows smoothly.

Step-by-Step Guide to Setting Up and Deploying the Application Load Balancer Controller in Kubernetes

Setting up an Application Load Balancer (ALB) in Kubernetes is key to distributing traffic evenly across your services, improving performance, and maintaining high availability. If you're using Amazon EKS (Elastic Kubernetes Service), the AWS ALB Ingress Controller makes this process much simpler.

Here’s a straightforward guide to setting up and deploying the AWS ALB Ingress Controller in your Kubernetes cluster.

Prerequisites

Before starting, ensure that you have the following:

  1. A working Amazon EKS cluster.
  2. kubectl installed and configured for your cluster.
  3. The necessary IAM permissions to manage resources in EKS.
  4. Helm 3 installed for managing Kubernetes applications.
  5. The AWS CLI set up and configured on your local machine.

Step 1: Install the AWS Load Balancer Controller using Helm

The AWS Load Balancer Controller is installed via Helm, a tool for managing Kubernetes applications. Here’s how you can install it:

1.1. Add the AWS Helm Repository

First, add the official AWS Helm repository to your setup:

helm repo add eks https://aws.github.io/eks-charts
helm repo update

1.2. Install the Controller

Once the repository is added, you can install the AWS Load Balancer Controller with this command:

helm install aws-load-balancer-controller eks/aws-load-balancer-controller \
--set clusterName=<your-cluster-name> \
--set serviceAccount.create=false \
--set serviceAccount.name=aws-load-balancer-controller \
--namespace kube-system

Make sure to replace <your-cluster-name> with your actual EKS cluster name. This command installs the ALB Ingress Controller into the kube-system namespace, and uses an existing service account (which we will create in the next step).

Step 2: Create the IAM Policy and Role

To allow the AWS Load Balancer Controller to interact with AWS resources like load balancers and security groups, you need to create an IAM policy and attach it to a service account.

2.1. Create the IAM Policy

Start by creating an IAM policy with the required permissions:

aws iam create-policy \
--policy-name AWSLoadBalancerControllerIAMPolicy \
--policy-document file://iam-policy.json

Here’s an example iam-policy.json file with the required permissions:

{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"elasticloadbalancing:*",
"ec2:Describe*",
"ec2:AuthorizeSecurityGroupIngress",
"ec2:CreateSecurityGroup",
"ec2:DeleteSecurityGroup"
],
"Resource": "*"
}
]
}

2.2. Create the IAM Role and Attach the Policy

Once the policy is created, attach it to an IAM role using the following command:

eksctl create iamserviceaccount \
--region <region> \
--name aws-load-balancer-controller \
--namespace kube-system \
--cluster <your-cluster-name> \
--attach-policy-arn arn:aws:iam::<account-id>:policy/AWSLoadBalancerControllerIAMPolicy \
--approve \
--override-existing-serviceaccounts

Replace <region>, <your-cluster-name>, and <account-id> with your actual values.

Step 3: Create and Apply the Ingress Resource

Now that the controller is installed, the next step is to define the routing rules for your Application Load Balancer using an Ingress resource.

3.1. Create the Ingress Resource

Here’s an example YAML file for creating an Ingress resource. This defines how the ALB should route traffic to your service:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: example-ingress
namespace: default
annotations:
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/target-type: ip
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}]'
alb.ingress.kubernetes.io/backend-protocol: HTTP
spec:
rules:
- host: <your-domain>.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: <your-service-name>
port:
number: 80

In this example, replace <your-domain> with your domain name and <your-service-name> with the name of the service you want to expose.

3.2. Apply the Ingress Resource

Once you’ve created the YAML file, apply it to your Kubernetes cluster:

kubectl apply -f example-ingress.yaml

Step 4: Verify the ALB Deployment

After applying the Ingress resource, verify the status of the ALB by running:

kubectl get ingress

You should see the external DNS name of the ALB in the output. If everything is set up correctly, the ALB will be managing traffic to your backend service.

Step 5: Test the Setup

To test, navigate to your domain in a browser. The ALB should route the traffic to your backend service, and the load will be distributed across your Kubernetes pods. If you see the expected result, then the setup is working correctly.

Conclusion

Congratulations, you’ve successfully set up and deployed the AWS Application Load Balancer Controller in your Kubernetes cluster. With this setup, you can now manage and distribute external traffic efficiently across your services, ensuring better scalability, high availability, and a smooth user experience.


Next Article
Article Tags :

Similar Reads