2

I want to deploy Application Load Balancer for Traefik running in Kubernetes. So, I tried the following:

kind: Service
apiVersion: v1
metadata:
  name: traefik-application-elb
  namespace: kube-system
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-backend-protocol: "tcp"
    service.beta.kubernetes.io/aws-load-balancer-type: "elb"
    service.beta.kubernetes.io/aws-load-balancer-name: "eks-traefik-application-elb"
    service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags: "App=traefik,Env=dev"
spec:
  type: LoadBalancer
  ports:
    - protocol: TCP
      name: web
      port: 80
    - protocol: TCP
      name: websecure
      port: 443
  selector:
    app: traefik

But internet-facing Classic load balancer was created. Also tried service.beta.kubernetes.io/aws-load-balancer-type: "alb" but nothing changed.

What is wrong here ?

roy
  • 6,344
  • 24
  • 92
  • 174
  • 1
    To deploy an ALB automatically, you need to have a ALB controller running in your cluster, you can deploy it using helm or deployment file but you will have to create a IAM role and iam policy giving it access to be able to spin up load balancers, i followed the below guide step by step and was able to implement the same, it worked with some adjustments. https://docs.aws.amazon.com/eks/latest/userguide/aws-load-balancer-controller.html – DBSand Apr 06 '22 at 15:46

1 Answers1

1

From the docs: https://docs.aws.amazon.com/eks/latest/userguide/network-load-balancing.html

When you create a Kubernetes Service of type LoadBalancer, the AWS cloud provider load balancer controller creates AWS Classic Load Balancers by default, but can also create AWS Network Load Balancers.

ALB is not supported as a k8s load balancer. You can specify an NLB if desired.

However you can use ALB as an ingress controller with a deployment like this - https://aws.amazon.com/blogs/containers/introducing-aws-load-balancer-controller/

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: SearchApp
  annotations:
    # share a single ALB with all ingress rules with search-app-ingress
    alb.ingress.kubernetes.io/group.name: search-app-ingress
spec:
  defaultBackend:
    service:
      name: search-svc # route traffic to the service search-svc
      port:
        number: 80

Glen Carpenter
  • 392
  • 2
  • 9