Azure 解决方案:使用Azure APIM在AKS中部署微服务

51CTO 博客地址:https://blog.51cto.com/14669127

博客园博客地址:https://www.cnblogs.com/Nancy1983

需求:企业正在设计一个将托管在Azure Kubernetes 服务(AKSCluster中的微服务架构。使用这些微服务的应用程序将托管在Azure的虚拟机上,虚拟机和AKS Cluster将在同一个虚拟网络中,需要设计一个解决方案来向consumer apps公开微服务,解决方案需要满足的条件:

1.      对微服务的入口访问必须限制为单个私有IP地址,采用 TLS双向认证

2.      微服务呼叫数量必须有速率限制

3.      成本必须降到最低限度

解决方案分析:一种选择是在Cluster VNet中部署APIMAPI Management),AKS Cluster 和使用微服务的应用程序可能在同一个VNet中,因此没有理由公开cluster,因为所有的API通信都将保留在VNet中,对于这些场景,可以将APIM部署到Cluster VNet中,API Management Premium tier支持VNet部署。

API Management部署到VNet有两种模式:外部模式和内部模式。

如果API Consumers不在Cluster VNet中,那么应该使用外部模式,在这种模式下,API Management网关被注入到Cluster VNet中,但可以通过外部负载均衡器从公共Internet访问,有助于完全隐藏Cluster,同时仍然允许外部客户机使用微服务,此外可以使用Azure网络功能,如网络安全组(NSG)来限制网络流量。

New Bitmap Image.bmp

如果所有的Consumers都在Cluster VNet中,那么可以使用内部模式,在这种模式下,API Management网关被注入到Cluster VNet中,并且只能通过内部负载均衡器从这个VNet中访问,从公共Internet无法到达API Management网关或AKS Cluster

New Bitmap Image.bmp

上述两种情况,AKS Cluster都不是公开可见的,Ingress Controller可能是不必要的,根据需求场景描述,仍然需要在API Management和微服务之间进行身份验证,比如采用Service MeshTLS双向认证等。

相关资料参考:

·       About API Management

·       Use Azure API Management with microservices deployed in Azure Kubernetes Service

 


猜你喜欢

转载自blog.51cto.com/14669127/2672192