0

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. I found this documentation page and tried the following API call:

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":[]}

Daniel
  • 509
  • 1
  • 4
  • 17

3 Answers3

2

By default the virtual machine scale set of AKS doesn't have public IP. AKS nodes do not require their own public IP addresses for communication.

But you can assign a public IP per node(preview mode).

Here is the link to official documentation:

https://learn.microsoft.com/en-us/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools-preview

Alex0M
  • 91
  • 2
2

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. It is entirely possible that your VMSS has no public IPs associated with the VMs.

bpdohall
  • 1,046
  • 6
  • 9
1

For your issue, you need to take care of the message that how does the VMSS create:

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.

Only in this way you can get the public IP addresses via the REST 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 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.

Charles Xu
  • 29,862
  • 2
  • 22
  • 39
  • Would it be possible to assign a single public ip to the whole virtual machine scale set, and not per vm? – Daniel Jun 19 '20 at 08:58
  • @Daniel If you mean only assign the public IP address to the instance of the VMSS without the Load Balancer or the Application gateway, you cannot achieve it. For AKS, it always uses an Ingress for the whole AKS cluster with only one public IP address. – Charles Xu Jun 19 '20 at 09:06