问题描述
我在集群中使用AKS
Am using AKS for my cluster
场景:我们有多个API(例如在端口101、102、103上可访问的svc1,svc2和svc3).这些API链接需要向客户端公开,并且还应在应用程序内部使用.
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.
问题:我想将其同时暴露给外部&内部负载均衡器在相同的端口上.另外,当我在内部访问该服务时,我希望它们可以通过服务名称进行访问(例如:svc1:101)
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)
推荐答案
好吧,我能够在不使用NodePort/ClusterIP的情况下解决此问题.
Well, I was able to fix the issue without using NodePort/ClusterIP.
解决方案非常简单,但似乎没有记录.
Solution is pretty simple but seems its not documented.
我们要做的就是拥有多个标签,其中1个标签与外部负载均衡器相同,而其他标签具有相同的匹配服务.
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.
有关详细答案,请访问- https: //www.linkedin.com/pulse/exposed-multiple-portsservices-same-load-balancer-sunil-agarwal
Detailed answer available on - https://www.linkedin.com/pulse/exposing-multiple-portsservices-same-load-balancer-sunil-agarwal
这篇关于Kubernetes:在内部公开多种服务&在外部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!