简体   繁体   English

如何通过 Azure CLI 扩展 Azure Kubernetes 集群

[英]How To Scale Azure Kubernetes Cluster via Azure CLI

When I try to scale my Azure Kubernetes cluster per the documentation like:当我尝试按照以下文档扩展我的 Azure Kubernetes 集群时:

az aks scale --resource-group my-resource-group --name my-cluster --node-count 5 --nodepool-name default

I get我明白了

cli.azure.cli.core.util : request failed: Error occurred in request., RetryError: HTTPSConnectionPool(host='management.azure.com', port=443): Max retries exceeded with url: /subscriptions/[subscriptionguid]/resourceGroups/my-resource-group/providers/Microsoft.ContainerService/managedClusters/my-cluster?api-version=2020-03-01 (Caused by ResponseError('too many 500 error responses',))
request failed: Error occurred in request., RetryError: HTTPSConnectionPool(host='management.azure.com', port=443): Max retries exceeded with url: /subscriptions/[subscriptionguid]/resourceGroups/my-resource-group/providers/Microsoft.ContainerService/managedClusters/my-cluster?api-version=2020-03-01 (Caused by ResponseError('too many 500 error 
responses',))

I'm on 2.3.1 of Azure CLI in Windows.我在 Windows 的 Azure CLI 的 2.3.1 上。 I've tried 2.2 in WSL too.我也在 WSL 中尝试过 2.2。 I am able to scale through the UI just fine.我能够很好地通过 UI 进行缩放。 Autoscaling is false.自动缩放是错误的。 There is only one node pool (called default).只有一个节点池(称为默认)。 This cluster was created through Terraform.该集群是通过 Terraform 创建的。 Other az commands work fine.其他 az 命令工作正常。 I've tried logging in as a user and as a service principal.我尝试以用户和服务主体身份登录。 I have no proxy.我没有代理。 If I add --debug nothing of immediate value pops up.如果我添加 --debug 没有立即值的弹出。

If I watch the http requests in Fiddler, the response bodies of the 500 results look like this:如果我在 Fiddler 中查看 http 请求,500 个结果的响应正文如下所示:

message=The credentials in ServicePrincipalProfile were invalid. Please see https://aka.ms/aks-sp-help for more details. (Details: adal: Refresh request failed. Status Code = '401'. Response body: {"error":"invalid_client","error_description":"AADSTS7000215: Invalid client secret is provided.\r\nTrace ID: 4d0fe224-1e60-4a91-91f1-399f697c0600\r\nCorrelation ID: 95b7e354-a63d-450e-8a7c-1851605a5b25\r\nTimestamp: 2020-04-07 13:51:07Z","error_codes":[7000215],"timestamp":"2020-04-07 13:51:07Z","trace_id":"4d0fe224-1e60-4a91-91f1-399f697c0600","correlation_id":"95b7e354-a63d-450e-8a7c-1851605a5b25","error_uri":"https://login.microsoftonline.com/error?code=7000215"})

If I do:如果我做:

az aks show --resource-group my-resource-group --name my-cluster --query agentPoolProfiles

it results in:结果是:

[
  {
    "availabilityZones": null,
    "count": 3,
    "enableAutoScaling": false,
    "enableNodePublicIp": null,
    "maxCount": null,
    "maxPods": 110,
    "minCount": null,
    "mode": "User",
    "name": "default",
    "nodeLabels": null,
    "nodeTaints": null,
    "orchestratorVersion": "1.15.7",
    "osDiskSizeGb": 30,
    "osType": "Linux",
    "provisioningState": "Succeeded",
    "scaleSetEvictionPolicy": null,
    "scaleSetPriority": null,
    "spotMaxPrice": null,
    "tags": null,
    "type": "AvailabilitySet",
    "vmSize": "Standard_D2_v3"
  }
]

What am I doing wrong?我究竟做错了什么? How do I get AKS to scale through the CLI?如何让 AKS 通过 CLI 进行扩展? Or failing those, how do I debug this?或者失败了,我该如何调试?

I ended up solving this by upgrading to the latest terraform version and terraform azure provider (I took azurerm from 1.32.1 to 2.0 and terraform from 0.12.17 to 0.12.24). I ended up solving this by upgrading to the latest terraform version and terraform azure provider (I took azurerm from 1.32.1 to 2.0 and terraform from 0.12.17 to 0.12.24). Then I deleted the cluster and had Terraform recreate it.然后我删除了集群并让 Terraform 重新创建它。 Now it scales from the command line just fine.现在它可以从命令行很好地扩展。 I suspect the relevant change it made is changing the type of node pool from "AvailabilitySet" to "VirtualMachineScaleSets".我怀疑它所做的相关更改是将节点池的类型从“AvailabilitySet”更改为“VirtualMachineScaleSets”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM