TL;博士。您可能希望使用 CLI(或其他方法)来部署 ACI。
请务必设置--ip_address public 或--dns-name-label <blah> in order to create public IP address。
例子:
az container create --resource-group myResourceGroup --name mycontainer --image mcr.microsoft.com/azuredocs/aci-helloworld --dns-name-label aci-demo --ports 80
参考:https://docs.microsoft.com/en-us/azure/container-instances/container-instances-quickstart
调查详情:
通过 Azure 门户部署 ACI 时,我能够重现相同的问题。我的猜测是:Azure 门户存在错误,它没有将公共 IP/DNS 标签发送到 Azure 控制平面,因此没有创建公共 IP 地址。
在这个截图中,我还提供了 DNS 名称标签并将 IP 地址设置为公共,我们可以检查 ARM 模板门户使用。
ARM 模板如下所示,您可以在其中看到 dnsNameLabel 被定义为参数,但在资源创建部分中没有被引用/应用
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string"
},
"containerName": {
"type": "string"
},
"imageType": {
"type": "string",
"allowedValues": [
"Public",
"Private"
]
},
"imageName": {
"type": "string"
},
"osType": {
"type": "string",
"allowedValues": [
"Linux",
"Windows"
]
},
"numberCpuCores": {
"type": "string"
},
"memory": {
"type": "string"
},
"restartPolicy": {
"type": "string",
"allowedValues": [
"OnFailure",
"Always",
"Never"
]
},
"ports": {
"type": "array"
},
"dnsNameLabel": {
"type": "string"
}
},
"resources": [
{
"location": "[parameters('location')]",
"name": "[parameters('containerName')]",
"type": "Microsoft.ContainerInstance/containerGroups",
"apiVersion": "2021-07-01",
"properties": {
"containers": [
{
"name": "[parameters('containerName')]",
"properties": {
"image": "[parameters('imageName')]",
"resources": {
"requests": {
"cpu": "[int(parameters('numberCpuCores'))]",
"memoryInGB": "[float(parameters('memory'))]"
}
},
"ports": "[parameters('ports')]"
}
}
],
"restartPolicy": "[parameters('restartPolicy')]",
"osType": "[parameters('osType')]"
},
"tags": {}
}
]
}