缩放 Azure Stack Hub 上的 Kubernetes 群集Scale a Kubernetes cluster on Azure Stack Hub

可以使用 scale 命令通过 AKS 引擎缩放群集。You can scale your cluster with the AKS engine using the scale command. scale 命令在输出目录中重用群集配置文件 (apimodel.json) 作为新的 Azure 资源管理器部署的输入。The scale command reuses your cluster configuration file (apimodel.json) inside the output directory as input for a new Azure Resource Manager deployment. 引擎会对指定的代理池执行缩放操作。The engine executes the scaling operation against the specified agent pool. 缩放操作完成后,引擎会更新该 apimodel.json 文件中的群集定义,以反映新的节点计数,从而反映更新的当前群集配置。When the scaling operation is done, the engine updates the cluster definition in that same apimodel.json file to reflect the new node count in order to reflect the updated, current cluster configuration.

缩放群集Scale a cluster

aks-engine scale 命令可以增加或减少 aks-engine Kubernetes 群集的现有代理池中的节点数。The aks-engine scale command can increase or decrease the number of nodes in an existing agent pool in an aks-engine Kubernetes cluster. 将始终在代理池的末尾添加或删除节点。Nodes will always be added or removed from the end of the agent pool. 删除之前,将封锁并排出节点。Nodes will be cordoned and drained before deletion.

scale 命令的值Values for the scale command

scale 命令使用以下参数查找群集定义文件并更新群集。The following parameters are used by the scale command to find your cluster definition file and update your cluster.

参数Parameter 示例Example 说明Description
azure-envazure-env AzureStackCloudAzureStackCloud 使用 Azure Stack Hub 时,环境名称需要设置为 AzureStackCloudWhen using Azure Stack Hub, the environment names needs to be set to AzureStackCloud.
locationlocation locallocal 这是 Azure Stack Hub 实例的区域。This is the region for your Azure Stack Hub instance. 对于 ASDK,此区域设置为 localFor an ASDK, the region is set to local.
resource-groupresource-group kube-rgkube-rg 包含群集的资源组的名称。The name of the resource group that contains your cluster.
subscription-idsubscription-id 订阅的 GUID,该订阅包含群集使用的资源。The GUID of the subscription that contains the resources used by your cluster. 请确保订阅上有足够的配额来进行扩展。Make sure you have enough quota on your subscription to scale.
client-idclient-id 通过 AKS 引擎创建群集时使用的服务主体的客户端 ID。The client ID of the service principal used in creating your cluster from the AKS engine.
client-secretclient-secret 创建群集时使用的服务主体机密。The service principal secret used when creating your cluster.
api-modelapi-model kube-rg/apimodel.jsonkube-rg/apimodel.json 群集定义文件 (apimodel.json) 的路径。The path to your cluster definition file (apimodel.json). 此路径可能为:_output/<dnsPrefix>/apimodel.jsonThis may be at: _output/<dnsPrefix>/apimodel.json
-new-node-count-new-node-count 99 所需节点计数。Desired node count.
-master-FQDN-master-FQDN 主 FQDN。Master FQDN. 纵向缩减时需要。Needed when scaling down.
identity-systemidentity-system adfsadfs 可选。Optional. 如果使用 Active Directory 联合身份验证服务 (AD FS),请指定标识管理解决方案。Specify your identity management solution if you are using Active Directory Federated Services (AD FS).

缩放 Azure Stack Hub 中的群集时,必须指定 --azure-env 参数。You must specify the --azure-env parameter when scaling a cluster in Azure Stack Hub. 若要详细了解 AKS 引擎的 scale 命令中使用的参数及其值,请参阅 Scale - 参数For more information about parameters and their values used in the scale command for the AKS engine, see Scale - parameters.

用于缩放群集的命令Command to scale your cluster

若要缩放群集,请运行以下命令:To scale the cluster you run the following command:

aks-engine scale \
    --azure-env AzureStackCloud   \
    --location <for an ASDK is local> \
    --resource-group <cluster resource group>
    --subscription-id xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
    --client-id xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
    --client-secret xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
    --api-model <path to your apomodel.json file>
    --new-node-count <desired node count> \
    --master-FQDN <master FQDN> \
    --identity-system adfs # required if using AD FS

后续步骤Next steps