Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Latest commit

 

History

History
110 lines (87 loc) · 3.79 KB

07-cluster-upgrading.md

File metadata and controls

110 lines (87 loc) · 3.79 KB

Upgrade an Azure Kubernetes Service (AKS) cluster

Azure Kubernetes Service (AKS) makes it easy to perform common management tasks including upgrading Kubernetes clusters.

#f03c15 Perform below steps in the Azure Cloud Shell

Upgrade an AKS cluster

Before upgrading a cluster, use the az aks get-versions --location <yourlocation> command to check which Kubernetes releases are available for upgrade.

az aks get-versions --location <yourlocation> --output table

Output:

KubernetesVersion    Upgrades
-------------------  -----------------------
1.12.5               None available
1.12.4               1.12.5
1.11.7               1.12.4, 1.12.5
1.11.6               1.11.7, 1.12.4, 1.12.5
1.10.12              1.11.6, 1.11.7
1.10.9               1.10.12, 1.11.6, 1.11.7
1.9.11               1.10.9, 1.10.12
1.9.10               1.9.11, 1.10.9, 1.10.12

For example for Kubernetes Version 1.10.9 we have three upgrades available: 1.10.12, 1.11.6, 1.11.7.

We can use the az aks upgrade command to upgrade to the latest available version. During the upgrade process, nodes are carefully cordoned and drained to minimize disruption to running applications. Before initiating a cluster upgrade, ensure that you have enough additional compute capacity to handle your workload as cluster nodes are added and removed.

Note:

Kubernetes may be unavailable during cluster upgrades. The upgrade may take 10 to 15 minutes.

As of today, the remaining lab exercises are tested with version 1.12.* and some of them require at least 1.12.6. We recommend you to upgrade the cluster to version 1.12.6.

Upgrade the cluster

az aks upgrade --name <CLUSTER_NAME> --resource-group <RESOURCE GROUP NAME> --kubernetes-version 1.12.6

Output:

{
  "agentPoolProfiles": [
    {
      "count": 2,
      "dnsPrefix": null,
      "fqdn": null,
      "name": "nodepool1",
      "osDiskSizeGb": null,
      "osType": "Linux",
      "ports": null,
      "storageProfile": "ManagedDisks",
      "vmSize": "Standard_DS2_v2",
      "vnetSubnetId": null
    }
  ],
  "dnsPrefix": "myakshyd-myakshyd-xxxx",
  "fqdn": "myakshyd-myakshyd-xxxxxa.hcp.westus.azmk8s.io",
  "id": "/subscriptions/xxxxxxxxxxx/resourcegroups/myakshyd/providers/Microsoft.ContainerService/ma                                                                 nagedClusters/myakshyd",
  "kubernetesVersion": "1.12.6",
  "linuxProfile": {
    "adminUsername": "azureuser",
    "ssh": {
      "publicKeys": [
        {
          "keyData": "ssh-rsa xxxxxxxxx"
        }
      ]
    }
  },
  "location": "westus",
  "name": "myakshyd",
  "provisioningState": "Succeeded",
  "resourceGroup": "myakshyd",
  "servicePrincipalProfile": {
    "clientId": "xxxxxxx",
    "keyVaultSecretRef": null,
    "secret": null
  },
  "tags": null,
  "type": "Microsoft.ContainerService/ManagedClusters"
}

You can now confirm the upgrade was successful with the az aks show command.

az aks show --name <CLUSTER_NAME> --resource-group <RESOURCE GROUP NAME> --output table

Output:

Name         Location    ResourceGroup    KubernetesVersion    ProvisioningState    Fqdn
-----------  ----------  ---------------  -------------------  -------------------  -----------------------------------------------------------
myakshyd     westus      myakshyd         1.12.6               Succeeded            myakshyd-myakshyd-xxxxx.hcp.eastus.azmk8s.io

Attribution:

Content originally created by @gabrtv et al. from this Azure Doc