在专用主机上部署Deploy on dedicated hosts

“专用”是指一个 Azure 容器实例 (ACI) SKU,它为安全运行的容器提供独立且专用的计算环境。"Dedicated" is an Azure Container Instances (ACI) sku that provides an isolated and dedicated compute environment for securely running containers. 使用专用 SKU 会使每个容器组在 Azure 数据中心拥有专用的物理服务器,确保工作负载完全隔离,有助于满足组织的安全性和符合性要求。Using the dedicated sku results in each container group having a dedicated physical server in an Azure datacenter, ensuring full workload isolation to help meet your organization's security and compliance requirements.

专用 SKU 适用于需要从物理服务器角度隔离工作负载的容器工作负载。The dedicated sku is appropriate for container workloads that require workload isolation from a physical server perspective.

先决条件Prerequisites

  • 使用专用 SKU 的任何订阅的默认限制均为 0。The default limit for any subscription to use the dedicated sku is 0. 如果要将此 SKU 用于生产容器部署,请创建 Azure 支持请求以增加限制。If you would like to use this sku for your production container deployments, create an Azure Support request to increase the limit.

使用专用 SKUUse the dedicated sku

重要

只能在当前推出的最新 API 版本 (2019-12-01) 中使用专用 SKU。请在部署模板中指定此 API 版本。Using the dedicated sku is only available in the latest API version (2019-12-01) that is currently rolling out. Specify this API version in your deployment template.

从 API 版本 2019-12-01 开始,部署模板的容器组属性部分下有一个 sku 属性,它是 ACI 部署所必需的。Starting with API version 2019-12-01, there is a sku property under the container group properties section of a deployment template, which is required for an ACI deployment. 目前,可以将此属性用作 ACI 的 Azure 资源管理器部署模板的一部分。Currently, you can use this property as part of an Azure Resource Manager deployment template for ACI. 若要详细了解如何使用模板来部署 ACI 资源,请参阅教程:使用资源管理器模板部署多容器组Learn more about deploying ACI resources with a template in the Tutorial: Deploy a multi-container group using a Resource Manager template.

sku 属性可以具有下列值之一:The sku property can have one of the following values:

  • Standard - 标准 ACI 部署选择,仍可保证虚拟机监控程序级别的安全性Standard - the standard ACI deployment choice, which still guarantees hypervisor-level security
  • Dedicated - 用于工作负载级别的隔离,对容器组使用专用物理主机Dedicated - used for workload level isolation with dedicated physical hosts for the container group

修改 JSON 部署模板Modify your JSON deployment template

在部署模板中,修改或添加以下属性:In your deployment template, modify or add the following properties:

  • resources 下,将 apiVersion 设置为 2019-12-01Under resources, set apiVersion to 2019-12-01.
  • 在容器组 properties 节下,添加值为 Dedicatedsku 属性。Under the container group properties, add a sku property with value Dedicated.

下面是使用专用 SKU 的容器组部署模板的 resources 节的示例代码片段:Here is an example snippet for the resources section of a container group deployment template that uses the dedicated sku:

[...]
"resources": [
    {
        "name": "[parameters('containerGroupName')]",
        "type": "Microsoft.ContainerInstance/containerGroups",
        "apiVersion": "2019-12-01",
        "location": "[resourceGroup().location]",    
        "properties": {
            "sku": "Dedicated",
            "containers": {
                [...]
            }
        }
    }
]

以下是一个完整模板,用于部署运行单个容器实例的示例容器组:Following is a complete template that deploys a sample container group running a single container instance:

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
      "containerGroupName": {
        "type": "string",
        "defaultValue": "myContainerGroup",
        "metadata": {
          "description": "Container Group name."
        }
      }
    },
    "resources": [
        {
            "name": "[parameters('containerGroupName')]",
            "type": "Microsoft.ContainerInstance/containerGroups",
            "apiVersion": "2019-12-01",
            "location": "[resourceGroup().location]",
            "properties": {
                "sku": "Dedicated",
                "containers": [
                    {
                        "name": "container1",
                        "properties": {
                            "image": "nginx",
                            "command": [
                                "/bin/sh",
                                "-c",
                                "while true; do echo `date`; sleep 1000000; done"
                            ],
                            "ports": [
                                {
                                    "protocol": "TCP",
                                    "port": 80
                                }
                            ],
                            "environmentVariables": [],
                            "resources": {
                                "requests": {
                                    "memoryInGB": 1.0,
                                    "cpu": 1
                                }
                            }
                        }
                    }
                ],
                "restartPolicy": "Always",
                "ipAddress": {
                    "ports": [
                        {
                            "protocol": "TCP",
                            "port": 80
                        }
                    ],
                    "type": "Public"
                },
                "osType": "Linux"
            },
            "tags": {}
        }
    ]
}

部署容器组Deploy your container group

使用 az group create 命令创建资源组。Create a resource group with the az group create command.

az group create --name myResourceGroup --location chinaeast2

使用 az deployment group create 命令部署模板。Deploy the template with the az deployment group create command.

az deployment group create --resource-group myResourceGroup --template-file deployment-template.json

将在几秒钟内收到来自 Azure 的初始响应。Within a few seconds, you should receive an initial response from Azure. 在专用主机上部署成功。A successful deployment takes place on a dedicated host.