Manage AKS Multi Node Pools – Preview

Azure Kubernetes Service aka AKS is the managed Kubernetes offering, Azure provide for the customers who need a robust container orchestration platform to run their micro service application. AKS has the capability of auto scale node, based on the demand need for the application or pods.

With the recent announcement of AKS team now it support to have multiple node pools for one AKS cluster.

As an example customer has different application runs on different resource requirement. As an assume customer has an application that need more memory. We need to deploy that application pods to a VMs which is optimized for memory consumed applications. With latest announcement now we can add a separate node pool which only contain memory optimize VMs and when we deploying the app we can specify those servers to deploy the app.

To add additional node pool to AKS follow steps mentioned below

Prerequisites

First step to enable the preview feature for AKS

# Install the aks-preview extension
az extension add --name aks-preview

# Update the extension to make sure you have the latest version installed
az extension update --name aks-preview

#Register the Preview Feature
az feature register --name MultiAgentpoolPreview --namespace Microsoft.ContainerService

#Query to verify the feature is enabled 
az feature list -o table --query "[?contains(name, 'Microsoft.ContainerService/MultiAgentpoolPreview')].{Name:name,State:properties.state}"

If the query result shown as Registered we can go to next step to create an additional node pool. In this I already have my existing AKS cluster, therefor I wont show you how to create a AKS cluster.

Create Additional Node Pool

az aks nodepool add --resource-group aks-demo --cluster-name aks --name memorypool --node-count 1 --node-vm-size Standard_E2s_v3 --kubernetes-version 1.12.7
  • –resource-group – Resource Group of the AKS cluster
  • –cluster-name – AKS Cluster Name
  • –name – Name of the Node Pool
  • –node-count – Number of VMs for a pool
  • –node-vm-size – Size of the VMs running on the pool
  • –kubernetes-version – Version of the Kubernetes

After Node Pool created successfully we will taint the node with NoSchedule. So API Server would’t deploy any pods to those nodes. But in the YAML of the memory app we will put a tolerations to deploy the apps to memory optimize pool.

Taint the nodes

kubectl taint node aks-memorypool-50069600-vmss000000 sku=memory:NoSchedule

Create YAML for sample NGINX app

apiVersion: v1
kind: Pod
metadata:
  name: memorypod
spec:
  containers:
  - image: nginx:1.15.9
    name: mypod
    resources:
      requests:
        cpu: 100m
        memory: 5G
      limits:
        cpu: 1
        memory: 10G
  tolerations:
  - key: "sku"
    operator: "Equal"
    value: "memory"
    effect: "NoSchedule"

When we deploy the above YAML this pod will deployed in to the node that used for memory

kubectl describe pod memorypod

After you enter above under Node we can find the server the app is deployed.

Following video will walkthrough all steps I performed above