简体   繁体   English

我可以使用 Azure REST ZDB974238714CA8DE3CE38A 获取虚拟机规模集的公共 IP 吗?

[英]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.

相关问题 Azure 虚拟机规模集代理公共 IP - Azure virtual machine scale set agents public IP 如何在 Azure 规模集中获取虚拟机的公共 DNS 名称 - How to get public DNS name of a Virtual Machine in Azure Scale Set 无法在 Azure 中使用 Python SDK 获取虚拟机规模集的公共 IP 地址 - Not able to fetch public IP address of virtual machine scale set with Python SDK in Azure 为现有虚拟机规模集添加公用IP - Adding public IP for existing virtual machine scale set 使用资源管理器在虚拟机规模集上设置Azure多个公共IP - Azure Multiple Public IPs on a Virtual Machine Scale Set with Resource Manager 使用 Rest Api 创建 azure 虚拟机后,我可以更改虚拟机自动关闭时间吗? - Can I change virtual machine auto shut down time after azure virtual machine created using Rest Api? 如何从python API azure sdk获取azure scale set实例的公共IP? - how to get public IP of azure scale set instance from python API azure sdk? 我可以使用 azure vm rest api (PUT) 更改现有虚拟机中的 Os 配置文件吗? - can I change Os profile in existing virtual machine using azure vm rest api (PUT)? 如何将 Azure 虚拟机规模集部署到现有虚拟网络? - How can I deploy an Azure virtual machine scale set to an existing virtual network? 如何使用 Azure CLI 命令获取虚拟机的公共 IP 地址 - How to get public ip address for virtual-machine using Azure CLI command
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM