[英]Can I get the public IP of a Virtual Machine Scale Set using Azure REST API?
I have a AKS cluster and I want to get the public IP of the virtual machine scale set associated with the cluster's agentpool.我有一个 AKS 群集,我想获取与群集的代理池关联的虚拟机规模集的公共 IP。 I found this documentation page and tried the following API call:
我找到了这个文档页面并尝试了以下 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
but i get this response: {"value":[]}
但我得到了这个回复:
{"value":[]}
By default the virtual machine scale set of AKS doesn't have public IP.默认情况下,AKS 的虚拟机规模集没有公共 IP。 AKS nodes do not require their own public IP addresses for communication.
AKS 节点不需要自己的公共 IP 地址进行通信。
But you can assign a public IP per node(preview mode).但是您可以为每个节点分配一个公共 IP(预览模式)。
Here is the link to official documentation:这是官方文档的链接:
https://docs.microsoft.com/en-us/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools-preview https://docs.microsoft.com/en-us/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools-preview
You can validate whether the publicipaddresses
key of your scale set contains any values by visiting https://resources.azure.com/ and navigating to the scale set.您可以通过访问https://resources.azure.com/并导航到规模集来验证规模集的
publicipaddresses
键是否包含任何值。 It is entirely possible that your VMSS has no public IPs associated with the VMs.您的 VMSS 完全有可能没有与 VM 关联的公共 IP。
For your issue, you need to take care of the message that how does the VMSS create:对于您的问题,您需要注意 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.
若要使用 CLI 创建将公共 IP 地址分配给每个虚拟机的规模集,请将 --public-ip-per-vm 参数添加到 vmss create 命令。
Only in this way you can get the public IP addresses via the REST API:只有这样,您才能通过 REST API 获取公共 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
But when you create the AKS cluster and enable the VMSS as the agent pool, the VMSS always behind in a Load Balancer so that it's publicIpAddressConfiguration
property is null
and give your response as empty.但是,当您创建 AKS 集群并启用 VMSS 作为代理池时,VMSS 始终位于负载均衡器中,因此它的
publicIpAddressConfiguration
属性为null
并将您的响应设为空。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.