我可以使用 Azure REST API 获取虚拟机规模集的 public IP 吗?
Can I get the public IP of a Virtual Machine Scale Set using Azure REST API?
我有一个 AKS 群集,我想获取与群集代理池关联的虚拟机规模集的 public IP。我找到了这个 documentation page 并尝试了以下 API 调用:
GET https://management.azure.com/subscriptions/{your sub ID}/resourceGroups/{RG name}/providers/Microsoft.Compute/virtualMachineScaleSets/{scale set name}/publicipaddresses?api-version=2017-03-30
但我收到这样的回复:{"value":[]}
默认情况下,AKS 的虚拟机规模集没有 public IP。 AKS 节点不需要自己的 public IP 地址进行通信。
但是您可以为每个节点分配一个 public IP(预览模式)。
这里是link官方文档:
您可以通过访问 https://resources.azure.com/ 并导航到规模集来验证规模集的 publicipaddresses
键是否包含任何值。您的 VMSS 完全有可能没有 public 与 VM 关联的 IP。
对于您的问题,您需要注意 VMSS 如何创建的消息:
To create a scale set that assigns a public IP address to each virtual
machine with the CLI, add the --public-ip-per-vm parameter to the vmss
create command.
只有这样,您才能通过 REST API:
获取 public 个 IP 地址
GET https://management.azure.com/subscriptions/{your sub ID}/resourceGroups/{RG name}/providers/Microsoft.Compute/virtualMachineScaleSets/{scale set name}/publicipaddresses?api-version=2017-03-30
但是当您创建 AKS 集群并启用 VMSS 作为代理池时,VMSS 始终位于负载均衡器中,因此它 publicIpAddressConfiguration
属性 是 null
并给出您的回复为空。
我有一个 AKS 群集,我想获取与群集代理池关联的虚拟机规模集的 public IP。我找到了这个 documentation page 并尝试了以下 API 调用:
GET https://management.azure.com/subscriptions/{your sub ID}/resourceGroups/{RG name}/providers/Microsoft.Compute/virtualMachineScaleSets/{scale set name}/publicipaddresses?api-version=2017-03-30
但我收到这样的回复:{"value":[]}
默认情况下,AKS 的虚拟机规模集没有 public IP。 AKS 节点不需要自己的 public IP 地址进行通信。
但是您可以为每个节点分配一个 public IP(预览模式)。
这里是link官方文档:
您可以通过访问 https://resources.azure.com/ 并导航到规模集来验证规模集的 publicipaddresses
键是否包含任何值。您的 VMSS 完全有可能没有 public 与 VM 关联的 IP。
对于您的问题,您需要注意 VMSS 如何创建的消息:
To create a scale set that assigns a public IP address to each virtual machine with the CLI, add the --public-ip-per-vm parameter to the vmss create command.
只有这样,您才能通过 REST API:
获取 public 个 IP 地址GET https://management.azure.com/subscriptions/{your sub ID}/resourceGroups/{RG name}/providers/Microsoft.Compute/virtualMachineScaleSets/{scale set name}/publicipaddresses?api-version=2017-03-30
但是当您创建 AKS 集群并启用 VMSS 作为代理池时,VMSS 始终位于负载均衡器中,因此它 publicIpAddressConfiguration
属性 是 null
并给出您的回复为空。