You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

调用Azure REST API创建AKS Agent Pool时遇参数无效错误求助

解决NetworkCloud AKS代理池创建时的agentPoolProfile.name无效错误

问题描述

通过PUT请求创建NetworkCloud下的AKS节点池,请求地址格式:

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}/agentPools/{agentPoolName}?api-version=2023-07-01

使用参数值:

  • subscriptionId = abc
  • resourceGroupName = rg1
  • kubernetesClusterName = aks-us-east
  • agentPoolName = poolakstesting1

提交的请求体:

{
    "properties": {
        "vmSize": "Standard_D16s_v5", 
        "enableAutoScaling": true,
        "count": 1,
        "minCount": 0, 
        "maxCount": 12,
        "maxPods": 75,
        "mode": "User",
        "OSType": "Linux"
    }
}

收到错误响应:

{
"code": "InvalidParameter",
"details": null,
"message": "The value of parameter agentPoolProfile.name is invalid. Please see https://aka.ms/aks-naming-rules for more details.",
"subcode": "",
"target": "agentPoolProfile.name"
}

解决方法

1. 校验代理池名称合规性

先确认poolakstesting1是否符合AKS资源命名规则:

  • 长度限制1-63字符
  • 仅允许小写字母、数字、短横线(-)
  • 必须以小写字母或数字开头和结尾

若名称不符合规则,修改为合规名称即可。

2. 在请求体添加顶级name字段

尽管官方文档未明确说明,但NetworkCloud的Agent Pool创建API要求在请求体顶级层级添加name字段,其值必须与URL路径中的{agentPoolName}完全一致。

修正后的请求体示例:

{
    "name": "poolakstesting1",
    "properties": {
        "vmSize": "Standard_D16s_v5", 
        "enableAutoScaling": true,
        "count": 1,
        "minCount": 0, 
        "maxCount": 12,
        "maxPods": 75,
        "mode": "User",
        "OSType": "Linux"
    }
}

该字段用于确保请求体与URL指定的资源名称一致,添加后即可解决此错误。

内容的提问来源于stack exchange,提问作者P0intMaN

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.24 15:33:28