尝试更改 Kubernetes 集群中的最大节点数 returns 出错

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

我正在尝试通过 api 调用增加我的 aks 托管集群中的最大节点数,但我收到此错误:{"code":"BadRequest","message":"Changing property 'identity' is not allowed."}

我的 url 看起来像这样: https://management.azure.com/subscriptions/my_subscription_id/resourceGroups/my_resource_group/providers/Microsoft.ContainerService/managedClusters/my_aks_cluster?api-version=2020-02-01

我要发送的数据:
{"location":"My Location", "properties":{"agentPoolProfiles":[{"name":"agentpool_name","maxCount":3}]}}

您在传递给 API.I 的 JSON 中遗漏了一些属性,使用 fiddler 捕获流量,这是服务器除了要获得的内容:

{
    "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"
    }
}

用您的输入更新字段(注意用 % % 换行的变量)。

完整命令应如下所示:

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