快速入门:在 Azure 门户中创建虚拟机规模集Quickstart: Create a virtual machine scale set in the Azure portal

利用虚拟机规模集,可以部署和管理一组自动缩放的虚拟机。A virtual machine scale set allows you to deploy and manage a set of auto-scaling virtual machines. 可以手动缩放规模集中的 VM 数,也可以定义规则,以便根据资源使用情况(如 CPU 使用率、内存需求或网络流量)进行自动缩放。You can scale the number of VMs in the scale set manually, or define rules to autoscale based on resource usage like CPU, memory demand, or network traffic. 然后,Azure 负载均衡器会将流量分配到规模集中的 VM 实例。An Azure load balancer then distributes traffic to the VM instances in the scale set. 本快速入门介绍如何在 Azure 门户中创建虚拟机规模集。In this quickstart, you create a virtual machine scale set in the Azure portal.

如果没有 Azure 订阅,可在开始前创建一个试用帐户If you don't have an Azure subscription, create a Trial before you begin.

登录 AzureLog in to Azure

通过 https://portal.azure.cn 登录到 Azure 门户。Log in to the Azure portal at https://portal.azure.cn.

创建负载均衡器Create a load balancer

Azure 负载均衡器在运行正常的虚拟机实例之间分配传入流量。Azure load balancer distributes incoming traffic among healthy virtual machine instances.

首先,使用门户创建公共标准负载均衡器。First, create a public Standard Load Balancer by using the portal. 创建的名称和公共 IP 地址自动配置为负载均衡器的前端。The name and public IP address you create are automatically configured as the load balancer's front end.

  1. 在搜索框中,键入“负载均衡器”。In the search box, type load balancer. 在搜索结果中的“市场”下,选取“负载均衡器” 。Under Marketplace in the search results, pick Load balancer.

  2. 在“创建负载均衡器”页的“基本信息”选项卡中,输入或选择以下信息 :In the Basics tab of the Create load balancer page, enter or select the following information:

    设置Setting Value
    订阅Subscription 选择订阅。Select your subscription.
    资源组Resource group 选择“新建”并在文本框中键入 myVMSSResourceGroup。Select Create new and type myVMSSResourceGroup in the text box.
    名称Name myLoadBalancermyLoadBalancer
    区域Region 选择“中国北部”。Select China North.
    类型Type 选择“公共”。Select Public.
    SKUSKU 选择“标准”。Select Standard.
    公共 IP 地址Public IP address 选择“新建”。Select Create new.
    公共 IP 地址名称Public IP address name myPipmyPip
    分配Assignment 静态Static
  3. 完成操作后,选择“查看 + 创建”When you are done, select Review + create

  4. 通过验证后,选择“创建”。After it passes validation, select Create.

创建负载均衡器

创建虚拟机规模集Create virtual machine scale set

可使用 Windows Server 映像或 Linux 映像(如 RHEL、CentOS、Ubuntu 或 SLES)部署规模集。You can deploy a scale set with a Windows Server image or Linux image such as RHEL, CentOS, Ubuntu, or SLES.

  1. 在搜索框中键入“规模集”。Type Scale set in the search box. 在结果中的“市场”下,选择“虚拟机规模集” 。In the results, under Marketplace, select Virtual machine scale sets. 在“虚拟机规模集”页上选择“创建”,此操作将打开“创建虚拟机规模集”页。 Select Create on the Virtual machine scale sets page, which will open the Create a virtual machine scale set page.

  2. 在“基本信息”选项卡中的“项目详细信息”下,确保选择了正确的订阅,然后选择新建资源组。In the Basics tab, under Project details, make sure the correct subscription is selected and then choose to Create new resource group. 键入 myVMSSResourceGroup 作为名称,然后选择“确定”。Type myVMSSResourceGroup for the name and then select OK .

  3. 键入 myScaleSet 作为规模集的名称。Type myScaleSet as the name for your scale set.

  4. 在“区域”中,选择离你近的区域。In Region, select a region that is close to your area.

  5. 保留“业务流程模式”的规模集 VM 的默认值 。Leave the default value of ScaleSet VMs for Orchestration mode.

  6. 选择市场映像作为“映像”。Select a marketplace image for Image. 在此示例中,我们选择了“Ubuntu 服务器 18.04 LTS”。In this example, we have chosen Ubuntu Server 18.04 LTS.

  7. 输入所需的用户名,并选择首选的身份验证类型。Enter your desired username, and select which authentication type you prefer.

    • 密码长度必须至少为 12 个字符,并且必须满足以下 4 个复杂性要求的其中 3 个:1 个小写字符、1 个大写字符、1 个数字和 1 个特殊字符。A Password must be at least 12 characters long and meet three out of the four following complexity requirements: one lower case character, one upper case character, one number, and one special character. 有关详细信息,请参阅用户名和密码要求For more information, see username and password requirements.
    • 如果选择 Linux OS 磁盘映像,可选择 SSH 公钥。If you select a Linux OS disk image, you can instead choose SSH public key. 仅提供公钥,如 ~/.ssh/id_rsa.pubOnly provide your public key, such as ~/.ssh/id_rsa.pub. 可以创建和使用 SSH 密钥You can create and use SSH keys.

    创建虚拟机规模集

  8. 选择“下一步”以移动其他页面。Select Next to move the the other pages.

  9. 保留“实例”和“磁盘”页的默认值 。Leave the defaults for the Instance and Disks pages.

  10. 在“网络”页上的“负载平衡”下,选择“是”以将规模集实例置于负载均衡器之后 。On the Networking page, under Load balancing, select Yes to put the scale set instances behind a load balancer.

  11. 在“负载均衡选项”中,选择“Azure 负载均衡器” 。In Load balancing options, select Azure load balancer.

  12. 在“选择负载均衡器”中,选择先前创建的“myLoadBalancer”。In Select a load balancer, select myLoadBalancer that you created earlier.

  13. 对于“选择后端池”,选择“新建”,然后键入“myBackendPool”,再选择“创建” 。For Select a backend pool, select Create new, type myBackendPool, then select Create.

  14. 完成操作后,选择“查看 + 创建”。When you are done, select Review + create.

  15. 通过验证后,选择“创建”以部署规模集。After it passes validation, select Create to deploy the scale set.

清理资源Clean up resources

不再需要资源组、规模集和所有相关的资源时,可将其删除。When no longer needed, delete the resource group, scale set, and all related resources. 为此,请选择规模集的资源组,然后选择“删除”。To do so, select the resource group for the scale set and then select Delete.

后续步骤Next steps

在本快速入门中,我们已在 Azure 门户中创建了一个基本的规模集。In this quickstart, you created a basic scale set in the Azure portal. 若要了解详细信息,请继续学习有关如何创建和管理 Azure 虚拟机规模集的教程。To learn more, continue to the tutorial for how to create and manage Azure virtual machine scale sets.