Air-Gapped Upgrade with KubeKey
Air-gapped upgrade with KubeKey is recommended for users whose KubeSphere and Kubernetes were both deployed by KubeKey. If your Kubernetes cluster was provisioned by yourself or cloud providers, refer to Air-gapped Upgrade with ks-installer.
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.
- A Docker registry. You need to have a Harbor or other Docker registries. For more information, see Prepare a Private Image Registry.
- Make sure every node can push and pull images from the Docker Registry.
Upgrade KubeSphere and Kubernetes
Upgrading steps are different for single-node clusters (all-in-one) and multi-node clusters.
Info
System Requirements
Systems | Minimum Requirements (Each node) |
---|---|
Ubuntu 16.04, 18.04 | CPU: 2 Cores, Memory: 4 G, Disk Space: 40 G |
Debian Buster, Stretch | CPU: 2 Cores, Memory: 4 G, Disk Space: 40 G |
CentOS 7.x | CPU: 2 Cores, Memory: 4 G, Disk Space: 40 G |
Red Hat Enterprise Linux 7 | CPU: 2 Cores, Memory: 4 G, Disk Space: 40 G |
SUSE Linux Enterprise Server 15 /openSUSE Leap 15.2 | CPU: 2 Cores, Memory: 4 G, Disk Space: 40 G |
Note
Step 1: Download KubeKey
Similar to installing KubeSphere on Linux in an online environment, you need to download KubeKey v1.1.0 first. Download the tar.gz
file, and transfer it to your local machine which serves as the taskbox for installation. After you uncompress the file, execute the following command to make kk
executable:
chmod +x kk
Step 2: Prepare installation images
As you install KubeSphere and Kubernetes on Linux, you need to prepare an image package containing all the necessary images and download the Kubernetes binary file in advance.
-
Download the image list file
images-list.txt
from a machine that has access to Internet through the following command:curl -L -O https://github.com/kubesphere/ks-installer/releases/download/v3.1.1/images-list.txt
Note
This file lists images under##+modulename
based on different modules. You can add your own images to this file following the same rule. To view the complete file, see Appendix. -
Download
offline-installation-tool.sh
.curl -L -O https://github.com/kubesphere/ks-installer/releases/download/v3.1.1/offline-installation-tool.sh
-
Make the
.sh
file executable.chmod +x offline-installation-tool.sh
-
You can execute the command
./offline-installation-tool.sh -h
to see how to use the script:root@master:/home/ubuntu# ./offline-installation-tool.sh -h Usage: ./offline-installation-tool.sh [-l IMAGES-LIST] [-d IMAGES-DIR] [-r PRIVATE-REGISTRY] [-v KUBERNETES-VERSION ] Description: -b : save kubernetes' binaries. -d IMAGES-DIR : the dir of files (tar.gz) which generated by `docker save`. default: /home/ubuntu/kubesphere-images -l IMAGES-LIST : text file with list of images. -r PRIVATE-REGISTRY : target private registry:port. -s : save model will be applied. Pull the images in the IMAGES-LIST and save images as a tar.gz file. -v KUBERNETES-VERSION : download kubernetes' binaries. default: v1.17.9 -h : usage message
-
Download the Kubernetes binary file.
./offline-installation-tool.sh -b -v v1.17.9
If you cannot access the object storage service of Google, run the following command instead to add the environment variable to change the source.
export KKZONE=cn;./offline-installation-tool.sh -b -v v1.17.9
Note
-
You can change the Kubernetes version downloaded based on your needs. Recommended Kubernetes versions for KubeSphere v3.1.1: v1.17.9, v1.18.8, v1.19.8, v1.20.4 and v1.20.6. If you do not specify a Kubernetes version, KubeKey will install Kubernetes v1.19.8 by default. For more information about supported Kubernetes versions, see Support Matrix.
-
You can upgrade Kubernetes from v1.16.13 to v1.17.9 by downloading the v1.17.9 Kubernetes binary file, but for cross-version upgrades, all intermediate versions need to be downloaded in advance. For example, if you want to upgrade Kubernetes from v1.15.12 to v1.18.6, you need to download Kubernetes v1.16.13 and v1.17.9, and the v1.18.6 binary file.
-
After you run the script, a folder
kubekey
is automatically created. Note that this file andkk
must be placed in the same directory when you create the cluster later.
-
-
Pull images in
offline-installation-tool.sh
../offline-installation-tool.sh -s -l images-list.txt -d ./kubesphere-images
Note
You can choose to pull images as needed. For example, you can delete##k8s-images
and related images under it inimages-list.text
if you already have a Kubernetes cluster.
Step 3: Push images to your private registry
Transfer your packaged image file to your local machine and execute the following command to push it to the registry.
./offline-installation-tool.sh -l images-list.txt -d ./kubesphere-images -r dockerhub.kubekey.local
Note
dockerhub.kubekey.local
in the command. Make sure you use your own registry address.Air-gapped upgrade for all-in-one clusters
Example machines
Host Name | IP | Role | Port | URL |
---|---|---|---|---|
master | 192.168.1.1 | Docker registry | 5000 | http://192.168.1.1:5000 |
master | 192.168.1.1 | master, etcd, worker |
Versions
Kubernetes | KubeSphere | |
---|---|---|
Before | v1.16.13 | v3.0.0 |
After | v1.17.9 | v3.1.1 |
Upgrade a cluster
In this example, KubeSphere is installed on a single node, and you need to specify a configuration file to add host information. Besides, for air-gapped installation, pay special attention to .spec.registry.privateRegistry
, which must be set to your own registry address. For more information, see the following sections.
Create an example configuration file
Execute the following command to generate an example configuration file for installation:
./kk create config [--with-kubernetes version] [--with-kubesphere version] [(-f | --file) path]
For example:
./kk create config --with-kubernetes v1.17.9 --with-kubesphere v3.1.1 -f config-sample.yaml
Note
Edit the configuration file
Edit the configuration file config-sample.yaml
. Here is an example for your reference.
Warning
privateRegistry
, which is dockerhub.kubekey.local
in this example.Set hosts
of your config-sample.yaml
file:
hosts:
- {name: ks.master, address: 192.168.1.1, internalAddress: 192.168.1.1, user: root, password: Qcloud@123}
roleGroups:
etcd:
- ks.master
master:
- ks.master
worker:
- ks.master
Set privateRegistry
of your config-sample.yaml
file:
registry:
registryMirrors: []
insecureRegistries: []
privateRegistry: dockerhub.kubekey.local
Upgrade your single-node cluster to KubeSphere v3.1.1 and Kubernetes v1.17.9
./kk upgrade -f config-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
Air-gapped upgrade for multi-node clusters
Example machines
Host Name | IP | Role | Port | URL |
---|---|---|---|---|
master | 192.168.1.1 | Docker registry | 5000 | http://192.168.1.1:5000 |
master | 192.168.1.1 | master, etcd | ||
slave1 | 192.168.1.2 | worker | ||
slave1 | 192.168.1.3 | worker |
Versions
Kubernetes | KubeSphere | |
---|---|---|
Before | v1.16.13 | v3.0.0 |
After | v1.17.9 | v3.1.1 |
Upgrade a cluster
In this example, KubeSphere is installed on multiple nodes, so you need to specify a configuration file to add host information. Besides, for air-gapped installation, pay special attention to .spec.registry.privateRegistry
, which must be set to your own registry address. For more information, see the following sections.
Create an example configuration file
Execute the following command to generate an example configuration file for installation:
./kk create config [--with-kubernetes version] [--with-kubesphere version] [(-f | --file) path]
For example:
./kk create config --with-kubernetes v1.17.9 --with-kubesphere v3.1.1 -f config-sample.yaml
Note
Edit the configuration file
Edit the configuration file config-sample.yaml
. Here is an example for your reference.
Warning
privateRegistry
, which is dockerhub.kubekey.local
in this example.Set hosts
of your config-sample.yaml
file:
hosts:
- {name: ks.master, address: 192.168.1.1, internalAddress: 192.168.1.1, user: root, password: Qcloud@123}
- {name: ks.slave1, address: 192.168.1.2, internalAddress: 192.168.1.2, user: root, privateKeyPath: "/root/.ssh/kp-qingcloud"}
- {name: ks.slave2, address: 192.168.1.3, internalAddress: 192.168.1.3, user: root, privateKeyPath: "/root/.ssh/kp-qingcloud"}
roleGroups:
etcd:
- ks.master
master:
- ks.master
worker:
- ks.slave1
- ks.slave2
Set privateRegistry
of your config-sample.yaml
file:
registry:
registryMirrors: []
insecureRegistries: []
privateRegistry: dockerhub.kubekey.local
Upgrade your multi-node cluster to KubeSphere v3.1.1 and Kubernetes v1.17.9
./kk upgrade -f config-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
Feedback
Was this page Helpful?
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.