首页 > 解决方案 > 具有应用程序网关和 Azure LB 的 Azure ScaleSet

问题描述

是否可以部署一个规模集,该规模集可以接收来自 Internet(通过应用程序网关)以及来自内部服务器(vi azure loadbalancer)的流量。

请看图片以进行澄清

谢谢

标签: azure-vm-scale-set

解决方案


你当然可以!下面是一些使用 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}"}'

我还写了一篇描述规模集 + Azure 负载均衡器 + 应用网关场景的快速博客文章。有关更多信息,请在此处找到:https ://negatblog.wordpress.com/2018/06/21/scale-sets-and-load-balancers/

希望这可以帮助!:) -尼尔


推荐阅读