管理 AKS 群集的节点池

适用于:Azure Local 上的 AKS

注意

有关在 Windows Server 上的 AKS 中管理节点池的信息,请参阅 “管理节点池”。

在 Azure 本地的 AKS 中,相同配置的节点将分组到 节点池中。 这些节点池包含运行应用程序的底层 VM。 本文介绍如何为 AKS 群集创建和管理节点池。

创建 Kubernetes 群集

首先,创建具有单个节点池的 Kubernetes 群集:

az aksarc create -n <cluster name> -g <resource group> --custom-location <custom location Id> --vnet-ids <vnet id> --generate-ssh-keys

添加节点池

可以使用 az aksarc nodepool add 命令向现有群集添加节点池。 确保节点池的名称与现有节点池的名称不同:

az aksarc nodepool add --name <node pool name> -g <resource group> --cluster-name <cluster name> --os-sku <Linux or Windows> --node-count <count> --node-vm-size <vm size>

获取节点池的配置信息

要查看节点池的配置,请使用 az aksarc nodepool show 命令:

az aksarc nodepool show --cluster-name <cluster name> -n <node pool name> -g <resource group>

示例输出:

{
"availabilityZones": null,
"count": 1,
"extendedLocation": null,
"id":
"/subscriptions/&lt;subscription&gt;/resourceGroups/edgeci-registration-rr1s46r1710&lt;resource
group&gt;/providers/Microsoft.Kubernetes/connectedClusters/&lt;cluster
name&gt;/providers/Microsoft.HybridContainerService/provisionedClusterInstances/default/agentPools/&lt;nodepoolname&gt;",
"location": "westeurope",
"name": "nodepoolname",
"nodeImageVersion": null,
"osSku": "CBLMariner",
"osType": "Linux",
"provisioningState": "Succeeded",
"resourceGroup": "resourcegroup",
"status": {
  "errorMessage": null,
  "operationStatus": null,
  "readyReplicas": [
   {
    "count": 1,
    "vmSize": "Standard\_A4\_v2"
   }
  ]
},
"systemData": {
…
},
"tags": null,
"type":
"microsoft.hybridcontainerservice/provisionedclusterinstances/agentpools",
"vmSize": "Standard\_A4\_v2"
}

指定部署到节点池的最大 Pod 数

可以在群集创建时或创建新节点池时配置可部署到节点的最大 Pod 数。 如果在创建节点池时未指定 maxPods,则节点池的部署默认值为最多 110 个 Pod:

az aksarc nodepool add --cluster-name <cluster name> -n <node pool name> -g <resource group> --max-pods 50 --yes

缩放节点池

可以上下缩放节点池中的节点数量。

要缩放节点池中的节点数,请使用 az aksarc nodepool scale 命令。 以下示例将名为 nodepool1 的节点池中的节点数量缩放为 2:

az aksarc nodepool scale --cluster-name <cluster name> -n nodepool1 -g <resource group> --node-count 2 --yes

删除节点池

如果需要删除节点池,请使用 az aksarc nodepool delete 命令:

az aksarc nodepool delete --cluster-name <cluster name> -n <node pool name> -g <resource group> --yes

后续步骤