首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Rest的Azure容器服务

使用Rest的Azure容器服务
EN

Stack Overflow用户
提问于 2017-08-31 07:29:46
回答 2查看 837关注 0票数 0

我想创建带有资源组和特定Orchestrator Kubernetes集群的蔚蓝容器。

我知道使用CLI是可能的,但是我想使用Azure为容器服务提供的链接来实现这一点。

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

在AAD中注册了我的应用程序并提供了所需的权限。

获得访问令牌,并按链接向下面的api发出请求

放置management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}?api-version=2017-01-31,但我得到了错误

代码语言:javascript
复制
{
"error":  {
"code": "InvalidResource"
"message": "The resource definition is invalid."
}
}

据我所知,当请求体中没有任何内容时,我们会得到这个错误。

因此,我在这里的真正问题是,我是否希望使用API请求创建带有资源组和集群的容器服务。

请求体

代码语言:javascript
复制
    {
  "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"
          }
        ]
      }
    }
  }
}

响应获取

代码语言:javascript
复制
{
    "code": "BadRequest",
    "message": "An error has occurred in subscription <subscriptionid>, resourceGroup: tobeDeletedResourceGroup request: OrchestratorType has unknown orchestrator: ."
    }

请帮我解决这个问题

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2017-09-12 11:47:40

Azure REST文档中缺少两样东西。1)它需要像这样的带有orchestratorRelease的orchestratorType版本。"orchestratorProfile":{ "orchestratorType":"Kubernetes","orchestratorRelease":"1.7“} 2)因此,我向json添加了以下更新:

"masterProfile":{“计数”:1,"dnsPrefix":"testabc","vmSize":"Standard_D2_v2“}

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

票数 1
EN

Stack Overflow用户

发布于 2017-09-11 15:40:14

agentPoolProfiles应该是json对象的数组。我从azure-cli模拟单元测试中提取了这个例子,以帮助您提供一个参考框架。

https://gist.github.com/bacongobbler/470b8d139536144edf91174916ec4036

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45975699

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档