无需停机即可升级 Azure AKS

PSK*_*SKP 1 azure kubernetes azure-aks

我正在寻找在不停机的情况下为 Azure AKS 升级 k8s 版本的方法,并发现了这篇令人惊叹的博客文章https://omichels.github.io/zerodowntime-aks.html但我只在开始时遇到错误

因此,当前在我的地区运行的 k8s 版本不再可用。当我尝试创建临时节点池时出现以下错误

(AgentPoolK8sVersionNotSupported) Version 1.19.6 is not supported in this region. 
Please use [az aks get-versions] command to get the supported version list in this region. 
For more information, please check https://aka.ms/supported-version-list
Run Code Online (Sandbox Code Playgroud)

如何才能实现零停机升级?

小智 5

下面是我不停机升级的方法,供大家参考。

  1. 仅升级控制平面。(可以在azure门户上完成)在此输入图像描述

  2. 添加新的节点池。现在新节点池的版本更高(与控制平面相同)。然后为其添加标签,例如 nodePool=newNodePool

  3. 将所有应用程序修补到新节点池。(通过节点选择器)

    $ kubectl get deployment -n {namespace} -o name | xargs kubectl patch -p "{\"spec\":{\"template\":{\"spec\":{\"nodeSelector\":{\"nodePool\":\"newNodePool\"}}}}}" -n {namespace}

  4. 检查 Pod 是否已调度到新节点池。

    $ kubectl get pods -owide

  5. 删除旧节点池。