Daniel
Daniel

Reputation: 549

Trying to change maximum node count in a Kubernetes cluster returns an error

I'm trying to increase the maximum node count in my aks managed cluster with an api call, but I am getting this error: {"code":"BadRequest","message":"Changing property 'identity' is not allowed."}

My url looks like this: https://management.azure.com/subscriptions/my_subscription_id/resourceGroups/my_resource_group/providers/Microsoft.ContainerService/managedClusters/my_aks_cluster?api-version=2020-02-01

The data I'm trying to send:
{"location":"My Location", "properties":{"agentPoolProfiles":[{"name":"agentpool_name","maxCount":3}]}}

Upvotes: 1

Views: 359

Answers (1)

Amit Baranes
Amit Baranes

Reputation: 8122

You miss a few properties in the JSON you pass to the API.I capture the traffic using fiddler and this is what the server except to get:

{
    "id": "/subscriptions/%SUBSCRIPTION_ID%/resourcegroups/%RESOURCE_GROUP%/providers/Microsoft.ContainerService/managedClusters/%CLUSTER_NAME%/agentPools/%NODE_POOL_NAME%",
    "name": %NODE_POOL_NAME%,
    "type": "Microsoft.ContainerService/managedClusters/agentPools",
    "properties": {
        "count": 3,
        "vmSize": "Standard_D2s_v3",
        "osDiskSizeGB": 100,
        "vnetSubnetID": "/subscriptions/%SUBSCRIPTION_ID%resourceGroups/%VNET_RESOURCE_GROUP%/providers/Microsoft.Network/virtualNetworks/%CLUSTER_NAME%/subnets/%VNET_SUBNET_NAME%",
        "maxPods": 30,
        "type": "VirtualMachineScaleSets",
        "enableAutoScaling": false,
        "provisioningState": "Succeeded",
        "orchestratorVersion": "1.15.10",
        "enableNodePublicIP": false,
        "mode": "User",
        "osType": "Linux"
    }
}

Update the fields with your input (Be aware of the variables wrap with % % ).

The full command should look like that:

curl -X PUT -H "Authorization: Bearer [TOKEN]" -H "Content-Type: application/json" -d 'ABOVE_JSON' https://management.azure.com/subscriptions/%SUBSCRIPTION_ID%/resourceGroups/%RESOURCE_GROUP%/providers/Microsoft.ContainerService/managedClusters/%CLUSTER_NAME%/agentPools/%NODE_POOL_NAME%?api-version=2020-03-01

Upvotes: 2

Related Questions