You are viewing documentation for KubeSphere version:v3.0.0
KubeSphere v3.0.0 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date documentation, see the latest version.
Air-Gapped Upgrade with ks-installer
ks-installer is recommended for users whose Kubernetes clusters were not set up through the KubeSphere Installer, but hosted by cloud vendors. This tutorial is for upgrading KubeSphere only. Cluster operators are responsible for upgrading Kubernetes themselves beforehand.
Prerequisites
-
You need to have a KubeSphere cluster running version 2.1.1. If your KubeSphere version is v2.1.0 or earlier, upgrade to v2.1.1 first.
-
A Docker registry. You need to have a Harbor or other Docker registries. For more information, see Prepare a Private Image Registry.
-
Make sure you read Release Notes For 3.0.0 carefully.
Warning
Step 1: Prepare Installation Images
As you install KubeSphere in an air-gapped environment, you need to prepare an image package containing all the necessary images 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.0.0/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.0.0/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: ./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
-
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 2: 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.Step 3: Download Deployment Files
Similar to installing KubeSphere on an existing Kubernetes cluster in an online environment, you also need to download cluster-configuration.yaml
and kubesphere-installer.yaml
first.
-
Execute the following commands to download these two files and transfer them to your machine that serves as the taskbox for installation.
curl -L -O https://github.com/kubesphere/ks-installer/releases/download/v3.0.0/cluster-configuration.yaml curl -L -O https://github.com/kubesphere/ks-installer/releases/download/v3.0.0/kubesphere-installer.yaml
-
Edit
cluster-configuration.yaml
to add your private image registry. For example,dockerhub.kubekey.local
is the registry address in this tutorial, then use it as the value of.spec.local_registry
as below:spec: persistence: storageClass: "" authentication: jwtSecret: "" local_registry: dockerhub.kubekey.local # Add this line manually; make sure you use your own registry address.
Note
You can enable pluggable components in this YAML file to explore more features of KubeSphere. Refer to Enable Pluggle Components for more details. -
Save
cluster-configuration.yaml
after you finish editing it. Replaceks-installer
with your own registry address with the following command:sed -i "s#^\s*image: kubesphere.*/ks-installer:.*# image: dockerhub.kubekey.local/kubesphere/ks-installer:v3.0.0#" kubesphere-installer.yaml
Warning
dockerhub.kubekey.local
is the registry address in the command. Make sure you use your own registry address.
Step 4: Upgrade KubeSphere
Execute the following commands after you make sure that all steps above are completed.
kubectl apply -f kubesphere-installer.yaml && kubectl apply -f cluster-configuration.yaml
Step 5: Verify Installation
When the installation finishes, you can see the content as follows:
#####################################################
### Welcome to KubeSphere! ###
#####################################################
Console: http://192.168.0.2:30880
Account: admin
Password: P@88w0rd
NOTES:
1. After logging into the console, please check the
monitoring status of service components in
the "Cluster Management". If any service is not
ready, please wait patiently until all components
are ready.
2. Please modify the default password after login.
#####################################################
https://kubesphere.io 20xx-xx-xx xx:xx:xx
#####################################################
Now, you will be able to access the web console of KubeSphere through http://{IP}:30880
with the default account and password admin/P@88w0rd
.
Note