'Can i replace loadbalancer in aks cluster

I am using multiple pods and their services, some of the services are of the type load balancer, which will expose the public IP.

But many of the services are called internally and no need to use public IP instead I can use private IP, what change do I need to make to the load balancer to use private IP.

I assume, the load balancer cost more compared to other types of services in the aks cluster.

Please let me know how to reduce the cost



Solution 1:[1]

Just do not annotate the services with type: LoadBalancer but instead use type: ClusterIP

Solution 2:[2]

You can annotate the service so that the Loadbalancer gets an private IP from your subnet:

service.beta.kubernetes.io/azure-load-balancer-internal: true

You can also check the docs here.

One hint: you should only expose the service from your Ingress Controller and not Services directly, This is an Kubernetes anti-pattern and insecure.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 silent
Solution 2 Philip Welz