使用虚拟网络部署容器实例的步骤

问题描述 投票:0回答:1

我想自动化虚拟网络(与另一个网络对等)的部署以及连接到该网络的容器实例的自动化。我只想确认我会执行正确的步骤。我将使用Azure REST API。

  1. 使用子网部署虚拟网络
  2. 创建与其他虚拟网络的对等网络
  3. 创建网络配置文件
  4. 使用创建的网络配置文件部署容器。

步骤3对我来说有点奇怪,因为它与我在Azure门户中所做的不同。在门户中,我只需选择要与容器连接的虚拟网络。在MSDN Docs看来,REST API要求我首先创建该网络配置文件。我说的对吗?

azure azure-virtual-network azure-container-instances azure-rest-api
1个回答
0
投票

[使用az container create部署容器时,az cli将在后台为您创建网络配置文件。

这可能是您以前可能没有看到网络配置文件显式创建的原因。

A network profile is a network configuration template for Azure resources. It specifies certain network properties for the resource, for example, the subnet into which it should be deployed. When you first use the az container create command to deploy a container group to a subnet (and thus a virtual network), Azure creates a network profile for you. You can then use that network profile for future deployments to the subnet.

https://docs.microsoft.com/en-us/azure/container-instances/container-instances-vnet#network-profile

您的步骤看起来不错。

© www.soinside.com 2019 - 2024. All rights reserved.