在 Azure Stack 中提供虚拟机规模集Make Virtual machine scale sets available in Azure Stack

适用于: Azure Stack 集成系统和 Azure Stack 开发工具包Applies to: Azure Stack integrated systems and Azure Stack Development Kit

虚拟机规模集是一种 Azure Stack 计算资源。Virtual machine scale sets are an Azure Stack compute resource. 可以使用它们部署和管理一组相同的虚拟机。You can use them to deploy and manage a set of identical virtual machines. 由于所有虚拟机的配置方式相同,因此规模集不需要预配虚拟机。With all virtual machines configured in the same way, scale sets do not require pre-provisioning of virtual machines. 可以更方便地构建面向大型计算、大数据、容器化工作负荷的大规模服务。It's easier to build large-scale services that target big compute, big data, and containerized workloads.

本文将指导你完成在 Azure Stack 市场中提供规模集的过程。This article guides you through the process of making scale sets available in the Azure Stack marketplace. 完成此过程之后,用户将可以将虚拟机规模集添加到其订阅。After you complete this procedure, your users can add virtual machine scale sets to their subscriptions.

Azure Stack 上的虚拟机规模集与 Azure 上的虚拟机规模集类似。Virtual machine scale sets on Azure Stack are similar to virtual machine scale sets on Azure. 有关详细信息,请参阅以下视频:For more information, see the following videos:

在 Azure Stack 上,虚拟机规模集不支持自动缩放。On Azure Stack, virtual machine scale sets do not support auto-scale. 可以使用资源管理器模板、CLI 或 PowerShell 将更多实例添加到规模集。You can add more instances to a scale set using Resource Manager templates, CLI, or PowerShell.

先决条件Prerequisites

  • 市场: 将 Azure Stack 注册到全球 Azure 以启用市场中项目的可用性。The Marketplace: Register Azure Stack with global Azure to enable the availability of items in the Marketplace. 请遵照将 Azure Stack 注册到 Azure 中的说明操作。Follow the instructions in Register Azure Stack with Azure.
  • 操作系统映像: 在创建虚拟机规模集之前,必须从 Azure Stack 市场下载 VM 映像,以便在规模集中使用。Operating system image: Before a virtual machine scale set can be created, you must download the VM images for use in the scale set from the Azure Stack marketplace. 必须已存在映像,然后用户才能创建新的规模集。The images must already be present before a user can create a new scale set.

使用 Azure Stack 门户Use the Azure Stack portal

Important

当使用的是 Azure Stack 版本 1808 或更高版本时,本部分中的信息适用。The information in this section applies when you use Azure Stack version 1808 or later. 如果版本为 1807 或更低版本,请参阅添加虚拟机规模集(1808 之前的版本)If your version is 1807 or earlier, see Add the Virtual Machine Scale Set (Prior to 1808).

  1. 登录到 Azure Stack 门户。Sign in to the Azure Stack portal. 然后,依次转到“所有服务”和“虚拟机规模集”,并在“计算”下选择“虚拟机规模集”。 Then, go to All services, then Virtual machine scale sets, and then under COMPUTE, select Virtual machine scale sets. 选择虚拟机规模集Select virtual machine scale sets

  2. 选择“创建虚拟机规模集”。Select Create Virtual machine scale sets. 创建虚拟机规模集Create a virtual machine scale set

  3. 填写空字段,对于“操作系统磁盘映像”、“订阅”和“实例大小”,请从下拉列表中进行选择。 Fill in the empty fields, choose from the dropdowns for Operating system disk image, Subscription, and Instance size. 对于“使用托管磁盘”,请选择“是”。 Select Yes for Use managed disks. 然后单击“创建” 。Then, click Create. 配置和创建Configure and create

  4. 若要查看新的虚拟机规模集,请转到“所有资源” ,搜索该虚拟机规模集名称,然后在搜索结果中单击其名称。To see your new virtual machine scale set, go to All resources, search for the virtual machine scale set name, and then select its name in the search. 查看规模集View the scale set

添加虚拟机规模集(版本 1808 之前的版本)Add the virtual machine scale set (prior to version 1808)

Important

当使用的是 1808 之前的 Azure Stack 版本时,本部分中的信息适用。The information in this section applies when you use a version of Azure Stack prior to 1808. 如果使用的是版本 1808 或更高版本,请参阅使用 Azure Stack 门户If you use version 1808 or later, see Use the Azure Stack portal.

  1. 打开 Azure Stack 市场并连接到 Azure。Open the Azure Stack marketplace and connect to Azure. 选择“市场管理”,然后单击“+ 从 Azure 添加”。 Select Marketplace management, then click + Add from Azure.

    市场管理

  2. 添加并下载虚拟机规模集市场项。Add and download the virtual machine scale set marketplace item.

    虚拟机规模集

更新虚拟机规模集中的映像Update images in a virtual machine scale set

创建虚拟机规模集之后,用户无需重新创建规模集即可更新规模集中的映像。After you create a virtual machine scale set, users can update images in the scale set without the scale set having to be recreated. 更新映像的过程取决于以下场景:The process to update an image depends on the following scenarios:

  1. 虚拟机规模集部署模板为 version 指定了 latestVirtual machine scale set deployment template specifies latest for version:

    如果规模集模板 imageReference 节中的 version 设置为 latest,则对规模集执行的纵向扩展操作将会针对规模集实例使用映像的最新可用版本。When the version is set to latest in the imageReference section of the template for a scale set, scale-up operations on the scale set use the newest available version of the image for the scale set instances. 完成纵向扩展后,可以删除旧的虚拟机规模集实例。After a scale-up is complete, you can delete older virtual machine scale sets instances. publisheroffersku 的值保持不变。The values for publisher, offer, and sku remain unchanged.

    以下 JSON 示例指定了 latestThe following JSON example specifies latest:

    "imageReference": {
        "publisher": "[parameters('osImagePublisher')]",
        "offer": "[parameters('osImageOffer')]",
        "sku": "[parameters('osImageSku')]",
        "version": "latest"
        }
    

    必须先下载新映像,然后纵向扩展才能使用新映像:Before scale-up can use a new image, you must download that new image:

    • 当市场中的映像版本比规模集中的映像版本要新时,下载新映像来替换旧映像。When the image on the marketplace is a newer version than the image in the scale set, download the new image that replaces the older image. 替换映像后,用户可以继续纵向扩展。After the image is replaced, a user can proceed to scale up.

    • 当市场中的映像版本与规模集中的映像版本相同时,删除规模集中使用的映像,然后下载新映像。When the image version on the marketplace is the same as the image in the scale set, delete the image that is in use in the scale set, and then download the new image. 在删除原始映像之后、下载新映像之前,无法执行纵向扩展。During the time between the removal of the original image and the download of the new image, you cannot scale up.

    需要执行此过程以重新合成利用稀疏文件格式(在版本 1803 中引入)的映像。This process is required to re-syndicate images that make use of the sparse file format, introduced with version 1803.

  2. 虚拟机规模集部署模板不会为 version 指定 latest,而是改为指定版本号:Virtual machine scale set deployment template does not specify latest for version and specifies a version number instead:

    如果下载较新版本的映像(会更改可用版本),则无法纵向扩展规模集。If you download an image with a newer version (which changes the available version), the scale set cannot scale up. 这是设计使然,因为规模集模板中指定的映像版本必须可用。This is by design, as the image version specified in the scale set template must be available.

有关详细信息,请参阅操作系统磁盘和映像For more information, see operating system disks and images.

缩放虚拟机规模集Scale a virtual machine scale set

可以缩放虚拟机规模集的大小以使其更大或更小。You can scale the size of a virtual machine scale set to make it larger or smaller.

  1. 在门户中,选择你的规模集,然后选择“缩放” 。In the portal, select your scale set and then select Scaling.

  2. 使用滑动条为此虚拟机规模集设置新的缩放级别,然后单击“保存”。 Use the slide bar to set the new level of scaling for this virtual machine scale set, and then click Save.

    缩放集

删除虚拟机规模集Remove a virtual machine scale set

若要删除虚拟机规模集库项,请运行以下 PowerShell 命令:To remove a virtual machine scale set gallery item, run the following PowerShell command:

Remove-AzsGalleryItem

Note

库项可能不会立即删除。The gallery item might not be removed immediately. 可能需要多次刷新门户,该项才会显示为已从市场中删除。You might need to refresh the portal several times before the item shows as removed from the Marketplace.

后续步骤Next steps