带有应用程序网关和 Azure LB 的 Azure 规模集

Azure ScaleSet with Application gateway & Azure LB

是否可以部署一个规模集来接收来自 Internet(通过应用程序网关)和内部服务器(通过 Azure 负载均衡器)的流量。

Please see image for clarification

谢谢

你当然可以!下面是一些使用 Azure CLI 的示例代码:

# create an Azure Load Balancer that is associated to a virtual network
# instead of a public IP:
$ az network lb create -g multirg -n privatealb --vnet-name vnet --subnet scalesetsubnet

# create an application gateway:
$ az network application-gateway create -g multirg -n appgw --vnet-name vnet --subnet appgwsubnet

# create a scale set associated with the app gateway (note: 'az vmss create'
# does not allow specifying multiple load balancers; we'll just create with
# the app gateway for now and add the Azure Load Balancers afterwards)
$ az vmss create -g multirg -n scaleset --app-gateway appgw --image UbuntuLTS --generate-ssh-keys --vnet-name vnet --subnet scalesetsubnet --upgrade-policy Automatic

# to associate the scale set with the load balancer post-creation,
# we will need to know the resource IDs of the load balancer's backend
# pool; we can get this using the 'az network lb show' command:
$ az network lb show -g multirg -n privatealb
{
 "backendAddressPools": [
 {
.
.
.
 "id": "{private-alb-pool-id}",
.
.
.
}

# we can then use the 'az vmss update' command to associate the Azure
# Load Balancer with the scale set:
az vmss update --resource-group multirg --name scaleset --add virtualMachineProfile.networkProfile.networkInterfaceConfigurations[0].ipConfigurations[0].LoadBalancerBackendAddressPools '{"id": "{private-alb-pool-id}"}'

我还写了一篇快速博客 post 描述规模集 + Azure 负载均衡器 + 应用程序网关方案。有关详细信息,请在此处找到:https://negatblog.wordpress.com/2018/06/21/scale-sets-and-load-balancers/

希望对您有所帮助! :) -尼尔