【发布时间】:2018-02-09 01:41:13
【问题描述】:
我想使用特定 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-version=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: ."
}
请帮我解决这个问题
【问题讨论】:
-
你的put body无效
-
@4c74356b41 对于 Swarm、DCOS 或 Custom 等任何编排器,我都会遇到同样的错误
-
@4c74356b41 你在 PUT 正文中看到了什么错误。请你详细说明一下好吗?或者如果您有样本 PUT 正文,请提供给我...
标签: azure azure-management-api azure-container-service