How I can disable "Kubernetes built-in service controller" to avoid creating load balancers automatically in my EKS

0

Current situation: New k8s Service of type "LoadBalancer" produces by default a classic load balancer on the public subnet.

Here there is some documentation about the built-in controller.

https://repost.aws/knowledge-center/eks-load-balancers-troubleshooting

I can not find anything regarding disabling or configuring it, I would like to create explicitly the aws loadbalancer if I need it.

I know that there is another managed controller for ALBs (https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.6/)

But I understand that installing it would not avoid aws loadbalancers being created from kubernetes services of type "LoadBalancer"

PD: Take into account that modifying the created k8s LBs is not an option for us.

Regards!

2 Answers
0

Hello,

By default, when we create a Service of type "loadBalancer", it creates Classic Load Balancer as it makes use of the kubernetes in-tree controller. The "LoadBalancer" type Service Exposes the Service externally using an external load balancer. So as our Kubernetes cluster is part of AWS EKS, it creates Classic Load Balancer by default and we cannot modify this behaviour.

However when you have AWS load balancer controller and you create Service of type "loadBalancer" with required annotations[1], you have provision of creating Application Load Balancer or Network Load Balancers as well.

To avoid Load Balancers from getting created, you need to create service of type "Cluster IP" or "NodePort". In "Cluster IP" Service, services can have a cluster-scoped virtual IP address. Clients can connect using that virtual IP address, and Kubernetes then load-balances traffic to that Service across the different backing Pods.

"NodePort" Service exposes the Service on each Node's IP at a static port (the NodePort). To make the node port available, Kubernetes sets up a cluster IP address, the same as if you had requested a Service of type: ClusterIP.

[1] https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.2/guide/service/annotations/

AWS
SUPPORT ENGINEER
answered 7 months ago
0

We have used another role for the cluster (not the AmazonEKSClusterPolicy), which is not giving it permissions to perform the actions that we don't want.

Thanks for your support!

Daniel
answered 7 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions