重新启动 AKS 节点池中规模集中的 VM

Bat*_*n22 3 python chaos kubernetes azure-aks azure-resource-graph

我有一个带有节点池的 kubernetes 集群,作为混沌工程计划的一部分,我需要重新启动虚拟机。是否有使用 azure 资源图的相同代码?

Cha*_* Xu 6

当 AKS 节点是规模集时。然后,您需要找到节点资源组、规模集名称和要重新启动的实例 ID。然后重新启动实例。以下是 CLI 命令:

# get the AKS node resource group name
az aks show -g groupName -n aksName --query nodeResourceGroup

# get the scale set info and all the instance id
az vmss list -g nodeGroupName --query [].name
az vmss list-instances -g nodeGroupName -n vmssName -o table

# restart the instance with the instance Id
az vmss restart -g nodeGroupName -n vmssName --instance-ids n
Run Code Online (Sandbox Code Playgroud)

如果在 Azure 门户中执行此操作,步骤相同,但更容易实现。