Description
Problem
The REST API endpoint: /subscriptions/{{subscription}}/providers/Microsoft.ContainerService/managedClusters
returns a value different from /subscriptions/{{subscription}}/resourceGroups/{{rg}}/providers/Microsoft.ContainerService/managedClusters/{{clustername}}
Description
I've created a Grafana dashboard to monitor when a nodepool reaches it's maxCount value.
Since then, I've noticed the REST API returns the wrong count number for some agentPoolProfiles whereas the Portal and az-cli returns the correct values. I have clusters stuck with the wrong count number for days, so it's not just a delay on the REST API side.
I checked it applies to the REST API versions 2020-09-01, 2020-06-01 and 2020-03-01.
It happened on clusters running Kubernetes versions 1.17.9 and 1.18.10.
Endpoint
Example
REST API Request
curl -X GET \ 'https://management.azure.com/subscriptions/{{subscription}}/providers/Microsoft.ContainerService/managedClusters?api-version=2020-09-01&skipToken=0'
REST API Response
"agentPoolProfiles": [
{
"name": "mynodepool",
"count": 10,
"vmSize": "Standard_D8s_v3",
"osDiskSizeGB": 512,
"vnetSubnetID": "/subscriptions/{{subscription}}/resourceGroups/{{rg}}/providers/Microsoft.Network/virtualNetworks/{{vnet}}/subnets/{{subnet}}",
"maxPods": 110,
"type": "VirtualMachineScaleSets",
"maxCount": 10,
"minCount": 5,
"enableAutoScaling": true,
"provisioningState": "Succeeded",
"orchestratorVersion": "1.18.10",
"enableNodePublicIP": false,
"nodeLabels": {
"app": "myapp"
},
"mode": "User",
"osType": "Linux"
},
AZ-CLI Request
az aks show --name {{clustername}} --resource-group {{rg}}
AZ-CLI Response
"agentPoolProfiles": [
{
"availabilityZones": null,
"count": 5,
"enableAutoScaling": true,
"enableNodePublicIp": false,
"maxCount": 10,
"maxPods": 110,
"minCount": 5,
"mode": "User",
"name": "mynodepool",
"nodeImageVersion": "AKSUbuntu-1804-2020.10.21",
"nodeLabels": {
"app": "myapp"
},
"nodeTaints": null,
"orchestratorVersion": "1.18.10",
"osDiskSizeGb": 512,
"osType": "Linux",
"provisioningState": "Succeeded",
"proximityPlacementGroupId": null,
"scaleSetEvictionPolicy": null,
"scaleSetPriority": null,
"spotMaxPrice": null,
"tags": null,
"type": "VirtualMachineScaleSets",
"upgradeSettings": null,
"vmSize": "Standard_D8s_v3",
"vnetSubnetId":
"/subscriptions/{{subscription}}/resourceGroups/{{rg}}/providers/Microsoft.Network/virtualNetworks/{{vnet}}/subnets/{{subnet}}"
}