【问题标题】:Azure Load balancer - Add existing VMs to Azure Load Balancer with ARM templateAzure 负载均衡器 - 使用 ARM 模板将现有 VM 添加到 Azure 负载均衡器
【发布时间】:2020-07-14 10:39:04
【问题描述】:

我有两个 VMS backendvm0 和 backendvm1,我正在尝试将这些 VMS 从负载均衡器 ARM 模板部署添加到 Azure 负载均衡器的后端池。我正在使用如下参数对象。它没有给出任何错误,正在使用名称 tlba001backendpool_test 创建负载平衡器,但它没有显示任何附加到它的 VM。

 "backendAddressPools": {
  "value": [
    {
      "name": "tlba001backendpool_test",
      "id": "",
      "properties": {
        "loadBalancerBackendAddresses": [
          {
            "name": "backendvm0",
            "properties": {
              "ipAddress": "10.0.2.5"
            }

          },
          {
            "name": "backendvm1",
            "properties": {
              "ipAddress": "10.0.2.4"
            }
          }
        ] 

      }
    }
  ]
},

enter image description here

【问题讨论】:

    标签: azure azure-devops arm-template azure-load-balancer azure-vm


    【解决方案1】:

    由于这是由 nic 属性而非负载均衡器管理的,因此您需要修改 NIC 属性并将 NIC 分配给负载均衡器。

    {
        "apiVersion": "2015-05-01-preview",
        "type": "Microsoft.Network/networkInterfaces",
        "name": "[concat(parameters('nicNamePrefix'), copyindex())]",
        "location": "[resourceGroup().location]",
        "copy": {
            "name": "nicLoop",
            "count": "[variables('numberOfInstances')]"
        },
        "dependsOn": [
            "[concat('Microsoft.Network/virtualNetworks/', parameters('vnetName'))]",
            "[concat('Microsoft.Network/loadBalancers/', parameters('lbName'))]"
        ],
        "properties": {
            "ipConfigurations": [
                {
                    "name": "ipconfig1",
                    "properties": {
                        "privateIPAllocationMethod": "Dynamic",
                        "subnet": {
                            "id": "[variables('subnetRef')]"
                        },
                        "loadBalancerBackendAddressPools": [
                            {
                                "id": "[concat(variables('lbID'), '/backendAddressPools/BackendPool1')]"
                            }
                        ]
                    }
                }
            ]
        }
    }
    

    https://github.com/Azure/azure-quickstart-templates/blob/master/201-2-vms-loadbalancer-lbrules/azuredeploy.json

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多