将应用服务连接到不同资源组中的负载均衡集群

Connecting App Service to Load Balanced cluster in different Resource Groups

我在 Azure 中有 2 个独立的资源组:

  1. 包含一些服务,包括 Linux 应用服务托管 Python Django
  2. 包含我使用来自 here
  3. 的 ARM 模板创建的 ElasticSearch 集群

我想从(1)中的App服务连接到(2)中的ElasticSearch服务负载均衡器

我尝试使用

创建虚拟网络对等互连

az network vnet peering create -g $webResourceGroup -n web2es --vnet-name vnet --remote-vnet $remote_vnet --allow-vnet-access

其中 $webResourceGroup => (1)$remote_vnet => (2)

但是,当我尝试向 ElasticSearch 服务发出 HTTP 请求时,它就是不起作用。

我该如何修复或解决这个问题?

有一些 requirements and constraints 用于虚拟网络对等互连。

Resources in one virtual network cannot communicate with the front-end IP address of a Basic internal load balancer in a globally peered virtual network. Support for Basic Load Balancer only exists within the same region. Support for Standard Load Balancer exists for both, VNet Peering and Global VNet Peering. Services that use a Basic load balancer which will not work over Global VNet Peering are documented here.

因此,如果对等 VNet 位于不同区域,则无法通过负载均衡器的前端 IP 连接到 Basic 负载均衡器后面的资源。 Standard 负载均衡器不存在此限制。从 parameters,您会看到 loadBalancerInternalSkuloadBalancerExternalSku 默认为 basic,您应该使用 standard 负载均衡器。

此外,您应该 integrated your app with an Azure Virtual Network. Please note that you cannot reach resources across global peering connections(VNets are located in different regions) when you are using Regional VNet Integration which requires the app and the VNet must be in the same region. If so, you need to use Gateway required VNet Integration and VNet peering with gateway transit

如果可能,您可以在同一区域中创建所有资源,如 VNet、应用服务、集群。那么您的 VNet 集成不需要 VPN 网关。这可能有更少的限制并且更容易在您的场景中部署。

希望对您有所帮助。