Can I make sure that a "cordoned" node is the one deleted when I downsize the cluster in Azure AKS?

1/23/2020

I need to downsize a cluster from 3 to 2 nodes. I have critical pods running on some nodes (0 and 1). As I found that the last node (2) in the cluster is the one that has the non critical pods, I have "cordoned" it so it won't get any new ones. I wonder is if I can make sure that that last node (2) is the one that will be removed when I go to Azure portal and downsize my cluster to 2 nodes (it is the last node and it is cordoned).

I have read that if I manually delete the node, the system will still consider there are 3 nodes running so it's important to use the cluster management to downsize it.

-- icordoba
azure-kubernetes
kubernetes

1 Answer

1/23/2020

You cannot control which node will be removed when scaling down the AKS cluster.

However, there are some workarounds for that:

  1. Delete the cordoned node manually via portal and than launch upgrade. It would try to add the node but with no success because the subnet has no space left.

  2. Another option is to:

    • Set up cluster autoscaler with two nodes

    • Scale up the number of nodes in the UI

    • Drain the node you want to delete and wait for autoscaler do it's job

Here are some sources and useful info:

Please let me know if that helped.

-- OhHiMark
Source: StackOverflow