Search code examples
azureazure-aks

Azure Kubernetes Service (AKS) and the primary node pool


Foreword

When you create a Kubernetes cluster on AKS you specify the type of VMs you want to use for your nodes (--node-vm-size). I read that you can't change this after you create the Kubernetes cluster, which would mean that you'd be scaling vertically instead of horizontally whenever you add resources.

However, you can create different node pools in an AKS cluster that use different types of VMs for your nodes. So, I thought, if you want to "change" the type of VM that you chose initially, maybe add a new node pool and remove the old one ("nodepool1")?

I tried that through the following steps:

  • Create a node pool named "stda1v2" with a VM type of "Standard_A1_v2"
  • Delete "nodepool1" (az aks nodepool delete --cluster-name ... -g ... -n nodepool1

Unfortunately I was met with Primary agentpool cannot be deleted.

Question

What is the purpose of the "primary agentpool" which cannot be deleted, and does it matter (a lot) what type of VM I choose when I create the AKS cluster (in a real world scenario)?

Can I create other node pools and let the primary one live its life? Will it cause trouble in the future if I have node pools that use larger VMs for its nodes but the primary one still using "Standard_A1_v2" for example?


Solution

  • Primary node pool is the first nodepool in the cluster and you cannot delete it, because its currently not supported. You can create and delete additional node pools and just let primary be as it is. It will not create any trouble.

    For the primary node pool I suggest picking a VM size that makes more sense in a long run (since you cannot change it). B-series would be a good fit, since they are cheap and CPU\mem ratio is good for average workloads.

    ps. You can always scale primary node pool to 0 nodes, cordon the node and shut it down. You will have to repeat this post upgrade, but otherwise it will work

    EDIT: It is possible to delete system pool now, you need to first create another nodepool with the --mode switch set to 'system', then you'll be able to delete it.