skip to Main Content

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

3

Answers


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

    Login or Signup to reply.
  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.

    Login or Signup to reply.
  3. Declare type:ClusterIP instead of type:LoadBalancer under kind:Service

    It will generate Private IP for the service, which can be accessed with either IP or name of service.

    http://<servicename>.<namespace>.svc.cluster.local:<port number>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search