1

Am using AKS for my cluster

Scenario: We have multiple API's (say svc1, svc2 & svc3 accessible on port 101, 102, 103). These API links need to be exposed to client and are also used internally in application.

Question: I want to expose this to both external & internal load balancer on same ports. Also when i access the service internally, i want them to be accessible by service name (Example: svc1:101)

Sunil Agarwal
  • 4,097
  • 5
  • 44
  • 80

2 Answers2

2

Well, I was able to fix the issue without using NodePort/ClusterIP.

Solution is pretty simple but seems its not documented.

Only thing we have to do is have multiple tags where 1 tag is same as of external load balancer and other tag you have same matching service.

This will map your replicaset to both service & external loadbalancer.

Detailed answer available on - https://www.linkedin.com/pulse/exposing-multiple-portsservices-same-load-balancer-sunil-agarwal

Sunil Agarwal
  • 4,097
  • 5
  • 44
  • 80
1

In Kubernetes:

  • if you want to expose something internally only, you should use ClusterIP service type
  • if you want to expose both internally & externally, use LoadBalancer (or NodePort) service type.

Please check Kubernetes: Service Types for more details.

Rafał Leszko
  • 4,939
  • 10
  • 19
  • I know this. My requirement is i want both – Sunil Agarwal Oct 14 '20 at 15:19
  • if i use node port, for each service i will get different public IP. I want one common IP for all services (port will be different). At the same time, I want all services to be accessible internally. – Sunil Agarwal Oct 20 '20 at 10:19