我想创建带有资源组和特定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,但我得到了错误
{
"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: ."
}请帮我解决这个问题
发布于 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参数是非常令人惊讶和恼人的。
发布于 2017-09-11 15:40:14
agentPoolProfiles应该是json对象的数组。我从azure-cli模拟单元测试中提取了这个例子,以帮助您提供一个参考框架。
https://gist.github.com/bacongobbler/470b8d139536144edf91174916ec4036
https://stackoverflow.com/questions/45975699
复制相似问题