bor
bor

Reputation: 2351

How to Simulate Eviction of nodes in Azure Kubernetes

I have spot instance nodes in Azure Kubernetes Cluster. I want to simulate the eviction of a node so as to debug my code but not able to. All I could find in azure docs is we can simulate eviction for a single spot instance, using the following:

az vm simulate-eviction --resource-group test-eastus --name test-vm-26

However, I need to simulate the eviction of a spot node pool or a spot node in an AKS cluster.

Upvotes: 1

Views: 1483

Answers (1)

kavya Saraboju
kavya Saraboju

Reputation: 10831

For simulating evictions, there is no AKS REST API or Azure CLI command because evictions of the underlying infrastructure is not handled by AKS RP. Only during creation of the AKS cluster the AKS RP can set eviction Policy on the underlying infrastructure by instructing the Azure Compute RP to do so. Instead to simulate the eviction of node infrastructure, the customer can use az vmsss simulate-eviction command or the corresponding REST API.

az vmss simulate-eviction

az vmss simulate-eviction --instance-id
                          --name
                          --resource-group
                          [--subscription]

Reference Documents:



Use the following commands to get the name of the vmss with nodepool:

1.

 az aks nodepool list -g $ClusterRG --cluster-name $ClusterName -o
    table

Get the desired node pool name from the output

2.

 CLUSTER_RESOURCE_GROUP=$(az aks show  –resource-group YOUR_Resource_Group --name YOUR_AKS_Cluster --query
nodeResourceGroup -o tsv)
az vmss list -g $CLUSTER_RESOURCE_GROUP --query "[?tags.poolName ==    '<NODE_POOL_NAME>'].{VMSS_Name:name}" -o tsv

References:

  1. https://louisshih.gitbooks.io/kubernetes/content/chapter1.html
  2. https://ystatit.medium.com/azure-ssh-into-aks-nodes-471c07ad91ef
  3. https://learn.microsoft.com/en-us/cli/azure/vmss?view=azure-cli-latest#az_vmss_list_instances

(you may create vmss if you dont have it configured. Refer :create a VMSS)

Upvotes: 3

Related Questions