How to upgrade the AKS version via CLI

To upgrade the Azure Kubernetes Service version via command line is easy. Follow these steps below and be happy ????

First you need to login into your Azure account

az login

Then select your subscription

az account set -s <subscription id>

To see current version:

az aks get-upgrades
  --resource-group your-resgroup-name
  --name your-aks-name
  --query "{ current: controlPlaneProfile.kubernetesVersion,upgrades: controlPlaneProfile.upgrades }"

#Output should be something like this below:
{
    "current": "1.7.9",
    "upgrades": [
        "1.7.12",
        "1.8.1",
        "1.8.2",
        "1.8.6",
        "1.8.7"
    ]
}
az aks upgrade
  --resource-group your-resgroup-name
  --name your-aks-name
  --kubernetes-version 1.8.7

It takes some time, after that you can run again the command to verify the current version.

az aks get-upgrades
  --resource-group your-resgroup-name
  --name your-aks-name
  --query "{ current: controlPlaneProfile.kubernetesVersion,upgrades: controlPlaneProfile.upgrades }"

Related Post