使用RESTAPI的Azure容器服务

使用RESTAPI的Azure容器服务,azure,azure-management-api,azure-container-service,Azure,Azure Management Api,Azure Container Service,我想用特定Orchestrator Kubernetes群集的资源组和群集创建azure容器 我知道使用CLI是可能的,但我想使用此处给出的链接中的Azure Rest API来实现这一点 docs.microsoft.com/en-us/rest/api/container-service/containerservices/createorupdate 在AAD中注册我的应用程序并授予所需权限 获取访问令牌并根据链接向以下api发出请求 PUT management.azure.com/su

我想用特定Orchestrator Kubernetes群集的资源组和群集创建azure容器

我知道使用CLI是可能的,但我想使用此处给出的链接中的Azure Rest API来实现这一点

docs.microsoft.com/en-us/rest/api/container-service/containerservices/createorupdate

在AAD中注册我的应用程序并授予所需权限

获取访问令牌并根据链接向以下api发出请求

PUT management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}?api版本=2017-01-31 但我也有错误

{
"error":  {
"code": "InvalidResource"
"message": "The resource definition is invalid."
}
}
我理解,当请求正文中没有任何内容时,我们会出现此错误

所以这里我真正的问题是,我是否希望使用API请求创建具有资源组和集群的容器服务

请求主体

    {
  "id": "myCluster",
  "name": "myCluster",
  "type": "Microsoft.ContainerService/containerServices",
  "location": "southindia",
  "tags": {
    "tag": "test"
  },
  "properties": {
     "orchestratorProfile": {
      "orchestratorType": "Kubernetes"
    },
    "servicePrincipalProfile": {
      "clientId": "<clientid>,
      "secret": "<secret>"
    },
    "masterProfile": {
      "count": 1,
      "dnsPrefix": "testabc"
    },
    "agentPoolProfiles": {
      "name": "agentPool1234",
      "count": 2,
      "vmSize": "Standard_A1",
      "dnsPrefix": "testabcagents"
    },
    "linuxProfile": {
      "adminUsername": "kubeadmin",
      "ssh": {
        "publicKeys": [
          {
            "keyData": "sshkey"
          }
        ]
      }
    }
  }
}
获得响应

{
    "code": "BadRequest",
    "message": "An error has occurred in subscription <subscriptionid>, resourceGroup: tobeDeletedResourceGroup request: OrchestratorType has unknown orchestrator: ."
    }

请在这方面帮助我

agentPoolProfiles应该是一个json对象数组。我从中提取这个示例来帮助您了解参考框架


Azure REST API文档中缺少两件事。 1它需要orchestratorRelease版本,orchestratorType如下。orchestratorProfile:{ orchestratorType:Kubernetes, orchestratorRelease:1.7 } 2下一个关于Properties.MasterProfile.vmSize中缺少vmSize的错误。 因此,我为json添加了以下更新

主配置文件:{ 计数:1, dnsPrefix:testabc, vmSize:Standard_D2_v2 }


文档缺少这两个重要的json参数,这非常令人惊讶和恼火。

您的put body是invalid@4c74356b41对于Swarm、DCO或Custom@4c74356b41你们在身体里看到了什么错误的东西。请你详细解释一下好吗?或者,如果您有示例PUT body,请提供给我…是的,我使用AgentPool配置文件更新了我的AgentPool:[{name:AgentPool 1234,count:2,vmSize:Standard_A1,dnsPrefix:testabcagents}],但仍然收到相同的错误。