This topic describes how to upgrade the Kubernetes version of your cluster. The cluster upgrade process involves three phases: precheck, master node upgrade, and node upgrade. During master node upgrade, the serial number of the node (starting with 1) that is being upgraded is displayed in dedicated clusters. During node upgrade, the numbers of upgraded nodes and total nodes are displayed.

Background information

You can go to the Clusters page to check the Kubernetes version of your cluster and see whether a new version is available for upgrade.
Kubernetes version

How the upgrade works

The following figure shows how the upgrade works and the steps that are involved in the upgrade process.How the upgrade works
  • Upgrade policy
    The upgrade policy defines how the upgrade is implemented. Currently, the default policy is batch upgrade. The batch upgrade policy is used during node upgrade to upgrade nodes in the cluster in batches. The policy works as follows:
    • The first batch includes one node. The number of nodes increases by the power of 2 in subsequent batches. If you pause the upgrade and resume it later, the first batch after the pause includes one node and the number of nodes increases by the power of 2 in batches thereafter.
    • The maximum number of nodes in each batch does not exceed 10% of the total number of nodes.
  • Precheck

    When you start the upgrade process, a precheck is run automatically to detect possible upgrade issues. The system performs health checks on multiple aspects of the cluster to ensure that the upgrade can be completed smoothly.

    If your cluster contains configuration errors or potential risks, the precheck may fail as follows:Precheck
    Click View Details. You are redirected to the details page, which displays the cause of the failure.Precheck failed
    Note
    • If the precheck fails, you must resolve the issue. If you need help, .
    • If the precheck succeeds, the upgrade process starts automatically.
  • Pause the upgrade
    You can pause the upgrade process at any time during the upgrade.
    Note
    • After being paused, the upgrade will be completed on nodes that have started the upgrade. The upgrade will not be performed on nodes that have not started the upgrade.
    • We recommend that you do not perform operations on the cluster when the upgrade is paused and resume the upgrade as soon as possible.

    After the upgrade is paused, click Continue to resume the upgrade process.

    If an error occurs during the upgrade, the system pauses the upgrade process. The cause of the error will be displayed at the bottom of the page. You can troubleshoot the error accordingly or submit a ticket to ask for help.

  • Cancel the upgrade
    After the upgrade is paused, you can click Cancel to cancel the upgrade.Cancel the upgrade
    Note
    • After being canceled, the upgrade will be completed on nodes that have started the upgrade. The upgrade will not be performed on nodes that have not started the upgrade.
    • Nodes that have completed the upgrade are not affected.

Notes

  • To upgrade a cluster, nodes in the cluster must have Internet access to download upgrade packages.
  • Errors may occur during the upgrade process. To ensure data security, we recommend that you take snapshots of volumes before you start the upgrade. For more information about creating snapshots, see Create a snapshot.
  • When you upgrade Kubernetes from version 1.8.1 or 1.8.4 to 1.9.3, all Pods in the cluster will be restarted during the upgrade, causing your applications to temporarily crash. When you upgrade other Kubernetes versions, the applications will not be interrupted. If an application is dependent on the API server, the application may be negatively affected during the upgrade.
  • OSS volumes that are mounted to Kubernetes clusters using FlexVolume 1.11.2.5 or earlier versions will be remounted during the upgrade. You need to create Pods that use OSS volumes again after the upgrade.
  • If you have made configuration changes to the cluster, for example, creating SWAP partitions, errors may occur during the upgrade process.
  • You can pause the upgrade after a batch of nodes has completed the upgrade. We recommend that you do not perform operations on the cluster when the upgrade is paused and resume the upgrade as soon as possible. If the upgrade has been paused for more than 15 days, it will end automatically, deleting related events and log information.
  • During the upgrade process, do not modify the resources under the kube-upgrade namespace unless an error has occurred.
  • If an error occurs during the upgrade, the upgrade will be paused. You need to troubleshoot the error and delete the failed Pods under the kube-upgrade namespace. You can restart the upgrade after the error is resolved. If you need help, contact our technical support team.

Preparations

Before you start the upgrade process, use the following steps to make sure that the cluster is healthy.

  1. Log on to a master node. For more information, see Access clusters by using SSH and Connect to Kubernetes clusters through kubectl.
  2. Run the kubectl get cs command to check whether all modules in the cluster are healthy.
    NAME                 STATUS    MESSAGE              ERROR
     scheduler            Healthy   ok
     controller-manager   Healthy   ok
     etcd-0               Healthy   {"health": "true"}
     etcd-1               Healthy   {"health": "true"}
     etcd-2               Healthy   {"health": "true"}
  3. Run the kubectl get nodes command to check whether all nodes in the cluster are in the Ready state.
    Note To upgrade a cluster, all nodes must be in the Ready state.
    kubectl get nodes
     NAME                   STATUS    ROLES     AGE       VERSION
     cn-hangzhou.i-xxxxxx   Ready     master    38d       v1.11.5
     cn-hangzhou.i-xxxxxx   Ready     <none>    38d       v1.11.5
     cn-hangzhou.i-xxxxxx   Ready     <none>    38d       v1.11.5
     cn-hangzhou.i-xxxxxx   Ready     <none>    38d       v1.11.5
     cn-hangzhou.i-xxxxxx   Ready     master    38d       v1.11.5
     cn-hangzhou.i-xxxxxx   Ready     master    38d       v1.11.5

If abnormal nodes are found in the cluster, you must fix the issue before you can upgrade the cluster. Submit a ticket if you need help.

Procedure

  1. Log on to the Container Service console.
  2. In the left-side navigation pane, choose Clusters > Clusters. Find the target cluster and click Upgrade Cluster in the Actions column to go to the Cluster Upgrade page.
    Clusters
  3. Click Upgrade.
    Upgrade page
  4. In the dialog box that appears, click Confirm.
    Upgrade a cluster
    You can now view the progress of the upgrade. Upgrade process
    Note
    • If you need to pause the upgrade, click Pause.
    • After the upgrade is paused, you can click Cancel to cancel the upgrade process.Cancel the upgrade
After the upgrade is completed, you can go to the Clusters page and check the current Kubernetes version of your cluster.
Upgrade completed