Upgrade with KubeKey

KubeKey is recommended for users whose KubeSphere and Kubernetes were both installed by KubeKey. If your Kubernetes cluster was provisioned by yourself or cloud providers, refer to Upgrade with ks-installer.

This tutorial demonstrates how to upgrade your cluster using KubeKey.

Prerequisites

  • You need to have a KubeSphere cluster running v3.0.0. If your KubeSphere version is v2.1.1 or earlier, upgrade to v3.0.0 first.
  • Read Release Notes for 3.1.1 carefully.
  • Back up any important component beforehand.
  • Make your upgrade plan. Two scenarios are provided in this document for all-in-one clusters and multi-node clusters respectively.

Download KubeKey

Follow the steps below to download KubeKey before you upgrade your cluster.

Download KubeKey from its GitHub Release Page or use the following command directly.

curl -sfL https://get-kk.kubesphere.io | VERSION=v1.1.1 sh -

Run the following command first to make sure you download KubeKey from the correct zone.

export KKZONE=cn

Run the following command to download KubeKey:

curl -sfL https://get-kk.kubesphere.io | VERSION=v1.1.1 sh -

Note

After you download KubeKey, if you transfer it to a new machine also with poor network connections to Googleapis, you must run export KKZONE=cn again before you proceed with the steps below.

Note

The commands above download the latest release (v1.1.1) of KubeKey. You can change the version number in the command to download a specific version.

Make kk executable:

chmod +x kk

Upgrade KubeSphere and Kubernetes

Upgrading steps are different for single-node clusters (all-in-one) and multi-node clusters.

Info

When upgrading Kubernetes, KubeKey will upgrade from one MINOR version to the next MINOR version until the target version. For example, you may see the upgrading process going from 1.16 to 1.17 and to 1.18, instead of directly jumping to 1.18 from 1.16.

All-in-one cluster

Run the following command to use KubeKey to upgrade your single-node cluster to KubeSphere v3.1.1 and Kubernetes v1.20.4:

./kk upgrade --with-kubernetes v1.20.4 --with-kubesphere v3.1.1

To upgrade Kubernetes to a specific version, explicitly provide the version after the flag --with-kubernetes. Available versions are:

  • v1.17.0, v1.17.4, v1.17.5, v1.17.6, v1.17.7, v1.17.8, v1.17.9
  • v1.18.3, v1.18.5, v1.18.6, v1.18.8
  • v1.19.0, v1.19.8, v1.19.9
  • v1.20.4, v1.20.6

Multi-node cluster

Step 1: Generate a configuration file using KubeKey

This command creates a configuration file sample.yaml of your cluster.

./kk create config --from-cluster

Note

It assumes your kubeconfig is allocated in ~/.kube/config. You can change it with the flag --kubeconfig.

Step 2: Edit the configuration file template

Edit sample.yaml based on your cluster configuration. Make sure you replace the following fields correctly.

  • hosts: The basic information of your hosts (hostname and IP address) and how to connect to them using SSH.
  • roleGroups.etcd: Your etcd nodes.
  • controlPlaneEndpoint: Your load balancer address (optional).
  • registry: Your image registry information (optional).

Note

For more information, see Edit the configuration file or refer to the Cluster section of the complete configuration file for more information.

Step 3: Upgrade your cluster

The following command upgrades your cluster to KubeSphere v3.1.1 and Kubernetes v1.20.4:

./kk upgrade --with-kubernetes v1.20.4 --with-kubesphere v3.1.1 -f sample.yaml

To upgrade Kubernetes to a specific version, explicitly provide the version after the flag --with-kubernetes. Available versions are:

  • v1.17.0, v1.17.4, v1.17.5, v1.17.6, v1.17.7, v1.17.8, v1.17.9
  • v1.18.3, v1.18.5, v1.18.6, v1.18.8
  • v1.19.0, v1.19.8, v1.19.9
  • v1.20.4, v1.20.6

Note

To use new features of KubeSphere v3.1.1, you may need to enable some pluggable components after the upgrade.

Thanks for the feedback. If you have a specific question about how to use KubeSphere, ask it on Slack. Open an issue in the GitHub repo if you want to report a problem or suggest an improvement.