你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

为 Azure 容器实例创建备用池

重要

若要使备用池成功创建和管理资源,需要访问订阅中的关联资源。 确保为备用池资源提供程序分配正确的权限,以便备用池正常运行。 有关详细说明,请参阅 为备用池配置角色权限

本文逐步介绍如何创建容器组配置文件,并使用该配置文件为 Azure 容器实例配置备用池。

先决条件

在使用备用池之前,请完成功能注册并配置基于角色的访问控制。 有关详细信息,请参阅 在 Azure 容器实例中为备用池配置角色权限

创建容器组配置文件

容器组配置文件告知备用池如何在池中配置容器。 如果对容器组配置文件进行更改,则还需要更新备用池,确保更新应用于池中的实例。

若要使用机密容器,请在创建容器组配置文件时将 sku 类型更新为 Confidential

使用 az container container-group-profile create 创建容器组配置文件。 可以选择在容器组配置文件中包含配置映射详细信息。 有关配置映射的详细信息,请参阅使用配置映射

az container container-group-profile create \
    --resource-group myResourceGroup \
    --name mycontainergroupprofile \
    --___location WestCentralUS \
    --image nginx \
    --os-type Linux \ 
    --ip-address Public \ 
    --ports 8000 \ 
    --cpu 1 \
    --memory 1.5 \
    --restart-policy Never

创建备用池

使用 az standby-container-group-pool create 创建备用池,并将其与容器组配置文件相关联。

az standby-container-group-pool create \
   --resource-group myResourceGroup \
   --___location WestCentralUS \
   --name myStandbyPool \
   --max-ready-capacity 20 \
   --refill-policy always \
   --container-profile-id "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.ContainerInstance/containerGroupProfiles/mycontainergroupprofile"

后续步骤

请求备用池中的容器