Notă
Accesul la această pagină necesită autorizare. Puteți încerca să vă conectați sau să modificați directoarele.
Accesul la această pagină necesită autorizare. Puteți încerca să modificați directoarele.
As your application workload demands change, you might need to scale the number of nodes in a node pool in Azure Kubernetes Service (AKS). In this article, you learn how to manually and automatically scale node pools in AKS.
Prerequisites for AKS node pool scaling
- An existing AKS cluster with at least one node pool. If you need to create one, see Create an AKS cluster with node pools.
- You need the Azure CLI version 2.2.0 or later installed and configured. Run
az --versionto find the version. If you need to install or upgrade, see Install Azure CLI.
Scale a node pool manually
Scale the number of nodes in a node pool using the [
az aks nodepool scale][az-aks-nodepool-scale] command. The--node-countflag specifies the desired number of nodes in the node pool. In this example, the node pool is scaled to five nodes.az aks nodepool scale \ --resource-group <resource-group-name> \ --cluster-name <cluster-name> \ --name <node-pool-name> \ --node-count 5 \ --no-waitCheck the status of your node pools using the [
az aks nodepool list][az-aks-nodepool-list] command.az aks nodepool list --resource-group <resource-group-name> --cluster-name <cluster-name>The following example output shows the node pool is in the Scaling state with a new count of five nodes:
[ { ... "count": 5, ... "name": "<node-pool-name>", "orchestratorVersion": "1.15.7", ... "provisioningState": "Scaling", ... "vmSize": "Standard_DS2_v2", ... }, { ... "count": 2, ... "name": "<node-pool-name-2>", "orchestratorVersion": "1.15.7", ... "provisioningState": "Succeeded", ... "vmSize": "Standard_DS2_v2", ... } ]It takes a few minutes for the scale operation to complete. After the scale operation is complete, the node pool's
provisioningStatechanges to Succeeded.
Scale a node pool automatically with the cluster autoscaler
You can use the cluster autoscaler with multiple node pools, and you can enable it on individual node pools and pass unique autoscaling rules to them.
Scale a VMSS-backed node pool automatically with the cluster autoscaler
Enable the cluster autoscaler on an existing Virtual Machine Scale Set-backed node pool by using the [
az aks nodepool update][az-aks-nodepool-update] command with the--update-cluster-autoscalerflag. Use the--min-countand--max-countflags to set the minimum and maximum number of nodes in the node pool. In this example, the cluster autoscaler is enabled with a minimum count of one node and a maximum count of five nodes:az aks nodepool update \ --resource-group <resource-group-name> \ --cluster-name <cluster-name> \ --name <node-pool-name> \ --update-cluster-autoscaler \ --min-count 1 \ --max-count 5
Scale a Virtual Machines-backed node pool automatically with the cluster autoscaler
Important
The --update-cluster-autoscaler flag is only supported for node pools backed by Virtual Machine Scale Sets.
For Virtual Machines node pools, use the az aks nodepool auto-scale update command group, which requires Azure CLI version 2.90.0 or later:
az aks nodepool auto-scale update \
--resource-group <resource-group-name> \
--cluster-name <cluster-name> \
--name <node-pool-name> \
--min-count 1 \
--max-count 5
Note
If you want to disable the cluster autoscaler on a node pool, use the [az aks nodepool update][az-aks-nodepool-update] command with the --disable-cluster-autoscaler flag instead of --update-cluster-autoscaler. For Virtual Machines node pools, use az aks nodepool auto-scale delete instead.
Next steps: Manage node pools in AKS
To learn more about managing node pools in AKS, see Manage node pools in Azure Kubernetes Service (AKS).