我按照以下步骤缩减 AKS 节点池
我创建了名为 aks-clusterz 的 AKS 集群,扩展操作由集群自动缩放器执行
缩小操作将决定在缩小时删除或释放 Aks 集群中的节点
我已经安装了 Aks 预览扩展
az extension add --name aks-preview
创建了 20 个节点的节点池,并指定了缩容,节点将通过缩容模式释放
az aks nodepool add --node-count 20 --scale-down-mode Deallocate --node-osdisk-type Managed --max-pods 10 --name nodepool23 --cluster-name aks-clusterz --resource-group Alldemorg
通过将节点数更改为 5 并扩展节点池,我将重新分配给剩余的节点
az aks nodepool scale --node-count 5 --name nodepool23 --cluster-name aks-clusterz --resource-group Alldemorg
使用此命令删除了已释放的节点
az aks nodepool update --scale-down-mode Delete --name nodepool23 --cluster-name aks-clusterz --resource-group Alldemorg
不使用缩减模式的集群的默认行为是在我们缩减集群时删除节点,使用缩减可以通过设置缩减删除模式来明确实现
az aks nodepool add --enable-cluster-autoscaler --min-count 1 --max-count 10 --max-pods 10 --node-osdisk-type Managed --scale-down-mode Delete --name nodepool23z --cluster-name aks-clusterz --resource-group Alldemorg
笔记:
一次我们不能删除超过 30 个节点,如果我们删除超过 30 个节点,它将无法正常缩小
节点利用率水平定义为请求资源的总和除以其容量,基于它将监视的节点利用率