Viktigt!
För att väntelägespooler ska kunna skapa och hantera resurser krävs åtkomst till de associerade resurserna i din prenumeration. Se till att rätt behörigheter har tilldelats resursprovidern för väntelägespoolen för att väntelägespoolen ska fungera korrekt. Detaljerade anvisningar finns i konfigurera rollbehörigheter för väntelägespooler.
Den här artikeln beskriver hur du skapar en containergruppprofil och använder den profilen för att konfigurera en väntelägespool för Azure Container Instances.
Förutsättningar
Innan du använder väntelägespooler slutför du funktionsregistreringen och konfigurerar rollbaserade åtkomstkontroller. Mer information finns i Konfigurera rollbehörigheter för väntelägespooler i Azure Container Instances
Skapa en containergruppprofil
Containergruppprofilen anger för väntelägespoolen hur containrarna i poolen ska konfigureras. Om du gör ändringar i containergruppprofilen måste du också uppdatera väntelägespoolen för att säkerställa att uppdateringarna tillämpas på instanserna i poolen.
Om du vill använda konfidentiella containrar uppdaterar du sku typen till Confidential när du skapar din containergruppsprofil.
Skapa en containergruppsprofil med az container-group-profile create. Du kan också inkludera information om konfigurationskarta i containergruppprofilen. Mer information om konfigurationskartor finns i använda konfigurationskartor.
az container container-group-profile create \
--resource-group myResourceGroup \
--name mycontainergroupprofile \
--location WestCentralUS \
--image mcr.microsoft.com/azuredocs/aci-helloworld \
--os-type Linux \
--ip-address Public \
--ports 8000 \
--cpu 1 \
--memory 1.5 \
--restart-policy Never
Skapa en containergruppprofil med New-AzContainerInstanceContainerGroupProfile. Du kan också inkludera information om konfigurationskarta i containergruppprofilen. Mer information om konfigurationskartor finns i använda konfigurationskartor.
$port1 = New-AzContainerInstancePortObject -Port 8000 -Protocol TCP
$port2 = New-AzContainerInstancePortObject -Port 8001 -Protocol TCP
$container = New-AzContainerInstanceObject -Name mycontainer -Image mcr.microsoft.com/azuredocs/aci-helloworld -RequestCpu 1 -RequestMemoryInGb 1.5 -Port @($port1, $port2)
New-AzContainerInstanceContainerGroupProfile `
-ResourceGroupName myResourceGroup `
-Name mycontainergroupprofile `
-Location WestCentralUS `
-Container $container `
-OsType Linux `
-RestartPolicy "Never" `
-IpAddressType Public
Skapa en containergruppprofil och spara mallfilen. Distribuera mallen med az deployment group create eller New-AzResourceGroupDeployment. Du kan också inkludera information om konfigurationskarta i containergruppprofilen. Mer information om konfigurationskartor finns i använda konfigurationskartor.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.ContainerInstance/containerGroupProfiles",
"apiVersion": "2024-05-01-preview",
"name": "[parameters('profileName')]",
"location": "[parameters('location')]",
"properties": {
"containers": [
{
"name": "mycontainergroupprofile",
"properties": {
"image": "[parameters('containerImage')]",
"ports": [
{
"port": 8000
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1.5
}
},
"command": [],
"environmentVariables": []
}
}
],
"osType": "Linux",
"ipAddress": {
"type": "Public",
"ports": [
{
"protocol": "TCP",
"port": 8000
}
]
},
"imageRegistryCredentials": [],
"sku": "Standard"
}
}
],
"parameters": {
"profileName": {
"type": "string",
"defaultValue": "mycontainergroupprofile",
"metadata": {
"description": "Name of the container profile"
}
},
"location": {
"type": "string",
"defaultValue": "West Central US",
"metadata": {
"description": "Location for the resource"
}
},
"containerImage": {
"type": "string",
"defaultValue": "mcr.microsoft.com/azuredocs/aci-helloworld:latest",
"metadata": {
"description": "The container image to use"
}
}
}
}
Skapa en containergruppprofil med skapa eller uppdatera. Du kan också inkludera information om konfigurationskarta i containergruppprofilen. Mer information om konfigurationskartor finns i använda konfigurationskartor.
PUT https://management.azure.com/subscriptions/{SubscriptionID}/resourceGroups/myResourceGroup/providers/Microsoft.ContainerInstance/containerGroupProfiles/myContainerGroupProfile?api-version=2024-05-01-preview
Request Body
{
"location": "West Central US",
"properties":{
"containers": [
{
"name":"mycontainergroupprofile",
"properties": {
"command":[],
"environmentVariables":[],
"image":"mcr.microsoft.com/azuredocs/aci-helloworld:latest",
"ports":[
{
"port":8000
}
],
"resources": {
"requests": {
"cpu":1,
"memoryInGB":1.5
}
}
}
}
],
"imageRegistryCredentials":[],
"ipAddress":{
"ports":[
{
"protocol":"TCP",
"port":8000
}
],
"type":"Public"
},
"osType":"Linux",
"sku":"Standard"
}
}
Skapa en väntelägespool
Skapa en väntelägespool och associera den med en containergruppsprofil med 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"
Skapa en väntelägespool och associera den med en containergruppprofil med New-AzStandbyContainerGroupPool.
New-AzStandbyContainerGroupPool `
-ResourceGroup myResourceGroup `
-Location "WestCentralUS" `
-Name myStandbyPool `
-MaxReadyCapacity 20 `
-RefillPolicy always `
-ContainerProfileId "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.ContainerInstance/containerGroupProfiles/mycontainergroupprofile"
Skapa en väntelägespool och associera den med en containergruppprofil. Skapa en mall och distribuera den använd az deployment group create eller New-AzResourceGroupDeployment.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string",
"defaultValue": "West Central US"
},
"name": {
"type": "string",
"defaultValue": "myStandbyPool"
},
"maxReadyCapacity" : {
"type": "int",
"defaultValue": 10
},
"refillPolicy" : {
"type": "string",
"defaultValue": "always"
},
"containerGroupProfile" : {
"type": "string",
"defaultValue": "/subscriptions/{SubscriptionID}/resourceGroups/myResourceGroup/providers/Microsoft.ContainerInstance/containerGroupProfiles/mycontainergroupprofile"
}
},
"resources": [
{
"type": "Microsoft.StandbyPool/standbyContainerGroupPools",
"apiVersion": "2025-03-01",
"name": "[parameters('name')]",
"location": "[parameters('location')]",
"properties": {
"elasticityProfile": {
"maxReadyCapacity": "[parameters('maxReadyCapacity')]",
"refillPolicy": "[parameters('refillPolicy')]"
},
"containerGroupProfile": "[parameters('containerGroupProfile')]"
}
}
]
}
Skapa en väntelägespool och associera den med en containergruppsprofil med skapa eller uppdatera.
PUT https://management.azure.com/subscriptions/{SubscriptionID}/resourceGroups/myResourceGroup/providers/Microsoft.StandbyPool/standbyContainerGroupPools/myStandbyPool?api-version=2025-03-01
Request Body
{
"properties": {
"elasticityProfile": {
"maxReadyCapacity": 20,
"refillPolicy": "always"
},
"containerGroupProperties": {
"containerGroupProfile": {
"id": "/subscriptions/{SubscriptionID}/resourceGroups/myResourceGroup/providers/Microsoft.ContainerInstance/containerGroupProfiles/mycontainergroupprofile",
"revision": 1
}
}
},
"location": "West Central US"
}
Nästa steg
Begär en container från väntelägespoolen.