iT邦幫忙

2019 iT 邦幫忙鐵人賽

DAY 12
1

上一篇介紹自動擴充時有遇到 Client 版本和 Server 版本不匹配的狀況, 導致 CPU 監控的功能無法使用, 本篇筆記將介紹如何將 AKS 升級到新版本

升級 AKS 版本

(部分資訊將會遮罩)

  1. 使用命令 az login 登入 Azure
    https://ithelp.ithome.com.tw/upload/images/20181027/20111871M0JlkV6MNk.png
  2. 使用命令 az aks show -g 15maksrg -n 15makscls 列出目前 resource group 的 aks 叢集資訊, 其中 kubernetesVersion 為目前配置的 AKS 版本
PS C:\WINDOWS\system32> az aks list
[
  {
  <略…>
    "id": "/subscriptions/11e5233d-dbe1-4167-ac91-????????????/resourcegroups/15maksrg/providers/Microsoft.ContainerService/managedClusters/15makscls",
    "kubernetesVersion": "1.10.8",
    <略…>  
  }
]
  1. 使用命令 az aks get-versions -l southeastasia 列出 data center 可用的 kubernetes 版本, 其中 -llocation 參數, 以本例是 southeastasia data center
PS C:\WINDOWS\system32> az aks get-versions -l southeastasia
{
  "id": "/subscriptions/11e5233d-dbe1-4167-ac91-????????????/providers/Microsoft.ContainerService/locations/southeastasia/orchestrators",
  "name": "default",
  "orchestrators": [
    {
      "default": null,
      "orchestratorType": "Kubernetes",
      "orchestratorVersion": "1.7.15",
      "upgrades": [
        {
          "orchestratorType": null,
          "orchestratorVersion": "1.7.16"
        },
        {
          "orchestratorType": null,
          "orchestratorVersion": "1.8.14"
        },
        {
          "orchestratorType": null,
          "orchestratorVersion": "1.8.15"
        }
      ]
    },
    {
      "default": null,
      "orchestratorType": "Kubernetes",
      "orchestratorVersion": "1.7.16",
      "upgrades": [
        {
          "orchestratorType": null,
          "orchestratorVersion": "1.8.14"
        },
        {
          "orchestratorType": null,
          "orchestratorVersion": "1.8.15"
        }
      ]
    },
    {
      "default": null,
      "orchestratorType": "Kubernetes",
      "orchestratorVersion": "1.8.14",
      "upgrades": [
        {
          "orchestratorType": null,
          "orchestratorVersion": "1.8.15"
        },
        {
          "orchestratorType": null,
          "orchestratorVersion": "1.9.10"
        },
        {
          "orchestratorType": null,
          "orchestratorVersion": "1.9.11"
        }
      ]
    },
    {
      "default": null,
      "orchestratorType": "Kubernetes",
      "orchestratorVersion": "1.8.15",
      "upgrades": [
        {
          "orchestratorType": null,
          "orchestratorVersion": "1.9.10"
        },
        {
          "orchestratorType": null,
          "orchestratorVersion": "1.9.11"
        }
      ]
    },
    {
      "default": null,
      "orchestratorType": "Kubernetes",
      "orchestratorVersion": "1.9.10",
      "upgrades": [
        {
          "orchestratorType": null,
          "orchestratorVersion": "1.9.11"
        },
        {
          "orchestratorType": null,
          "orchestratorVersion": "1.10.7"
        },
        {
          "orchestratorType": null,
          "orchestratorVersion": "1.10.8"
        }
      ]
    },
    {
      "default": null,
      "orchestratorType": "Kubernetes",
      "orchestratorVersion": "1.9.11",
      "upgrades": [
        {
          "orchestratorType": null,
          "orchestratorVersion": "1.10.7"
        },
        {
          "orchestratorType": null,
          "orchestratorVersion": "1.10.8"
        }
      ]
    },
    {
      "default": null,
      "orchestratorType": "Kubernetes",
      "orchestratorVersion": "1.10.7",
      "upgrades": [
        {
          "orchestratorType": null,
          "orchestratorVersion": "1.10.8"
        },
        {
          "orchestratorType": null,
          "orchestratorVersion": "1.11.2"
        },
        {
          "orchestratorType": null,
          "orchestratorVersion": "1.11.3"
        }
      ]
    },
    {
      "default": true,
      "orchestratorType": "Kubernetes",
      "orchestratorVersion": "1.10.8",
      "upgrades": [
        {
          "orchestratorType": null,
          "orchestratorVersion": "1.11.2"
        },
        {
          "orchestratorType": null,
          "orchestratorVersion": "1.11.3"
        }
      ]
    },
    {
      "default": null,
      "orchestratorType": "Kubernetes",
      "orchestratorVersion": "1.11.2",
      "upgrades": [
        {
          "orchestratorType": null,
          "orchestratorVersion": "1.11.3"
        }
      ]
    },
    {
      "default": null,
      "orchestratorType": "Kubernetes",
      "orchestratorVersion": "1.11.3",
      "upgrades": null
    }
  ],
  "type": "Microsoft.ContainerService/locations/orchestrators"
}

由上述的可用版本清單, 最新的版本為 1.11.3 版, 版本升級時需要漸進式的升級, 例如 1.9.x 不能直接升級到 1.11.x 版本, 需要先升級到 1.10.8 後才能升級到 1.11.3
4. 使用命令 az aks upgrade -g 15maksrg -n 15makscluster -k "1.11.3" 將 aks 升級到 1.11.3 版本

PS C:\WINDOWS\system32> az aks upgrade -g 15maksrg -n 15makscls -k "1.11.3"
Kubernetes may be unavailable during cluster upgrades.
Are you sure you want to perform this operation? (y/n): y
{
  <略…>
  "id": "/subscriptions/11e5233d-dbe1-4167-ac91-????????????/resourcegroups/15maksrg/providers/Microsoft.ContainerService/managedClusters/15makscls",
  "kubernetesVersion": "1.11.3",
  <略…>
}
  1. 升級時可以在 Azure Portal 檢查狀態, 如下:
    https://ithelp.ithome.com.tw/upload/images/20181027/201118719mu2kgmPB8.png
  2. 完成後, 我們可以看到版本資訊便成為 1.11.3 了.
{
  <略…>
  "id": "/subscriptions/11e5233d-dbe1-4167-ac91-????????????/resourcegroups/15maksrg/providers/Microsoft.ContainerService/managedClusters/15makscls",
  "kubernetesVersion": "1.11.3",
  <略…>
}

是不是很簡單就能夠升級 AKS 囉?


上一篇
Day 11 - Azure Kubernetes Service (AKS) 水平自動擴充 Pod
下一篇
Day 13 - Kubernetes 中的應用程式升級
系列文
15 分鐘學習系列 - 第一次學 Kubernetes 就上手30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言