缩放时 Azure 虚拟机规模集命名不按顺序

Azure Virtual Machine Scale Set Naming not in Sequence when Scaled

当我手动将我的 vmss 从 2 调到 4 时,它提供了序号索引高于当前节点的新节点:

vm-01,vm-02,vm-06,vm-07

如果新的被删除并重新缩放将显示 vm-08 和 vm-09

有没有办法强制索引保持顺序?

无法将其排序为 1,2,3,4 。默认情况下,当您放大然后缩小时,id 最高的实例将被删除。因此,如果您再次尝试放大,那么它将考虑创建或删除的最高实例 id,然后添加新的规模集实例。

如虚拟机规模集常见问题解答中所述:

Q: If I reduce my scale set capacity from 20 to 15, which VMs are removed?

Ans: By default, virtual machines are removed from the scale set evenly across availability zones (if the scale set is deployed in zonal configuration) and fault domains to maximize availability. VMs with the highest IDs are removed first. You can change the order of virtual machine removal by specifying a scale-in policy for the scale set.

Q: What if I then increase the capacity from 15 to 18?

Ans: If you increase capacity to 18, then 3 new VMs are created. Each time, the VM instance ID is incremented from the previous highest value (for example, 20, 21, 22). VMs are balanced across fault domains.

参考:

Azure Virtual Machine Scale-sets FAQ