Kubernetes: Expose multiple services internally & externally

北城余情 提交于 2020-12-15 05:35:32

问题


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)


回答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.




回答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



来源:https://stackoverflow.com/questions/64348660/kubernetes-expose-multiple-services-internally-externally

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!