Before use Rancher service is installed inside the cluster k8s rke deployed, i.e., the cluster Rancher UI
master interface display local
cluster. The cluster generally do not do the upgrade, but the upgrade version is too old or under consideration.
1, View rke and k8s version
Login rancher host was deployed k8s of:prod-rancher-server-01
1) View rke version
[root@prod-rancher-server-01 deploy]# rke -v
rke version v0.2.4
2) View k8s latest supported version rke v0.2.4
[root@prod-rancher-server-01 deploy]# rke config --system-images --all |grep hyperkube
rancher/hyperkube:v1.12.7-rancher1
rancher/hyperkube:v1.13.5-rancher1
rancher/hyperkube:v1.14.1-rancher1
rancher/hyperkube:v1.11.9-rancher1
K8s listed above are all supported versions for the latest v1.14.1
version.
2. Download the latest version rke
Because now the latest version of k8s already v1.17.x, so the first version to download rke latest version v1.0.4 , support for the latest version v1.17.2 k8s
1) Download rke v1.0.4
wget https://docs.rancher.cn/download/rke/v1.0.4-rke_linux-amd64
2) rename and move to the storage path before
mv rke_linux-amd64 /opt/rancher/cli/rke
rke -v
3) Check k8s latest supported version rke v1.0.4
./rke config --system-images --all |grep hyperkube
rancher/hyperkube:v1.15.9-rancher1
rancher/hyperkube:v1.16.6-rancher1
rancher/hyperkube:v1.17.2-rancher1
Support for the latest version is k8s v1.17.2
version.
3, upgrade K8S
1) modifying cluster YAML file
RKE to support upgrade the system by changing the mirror image version. For example, to change the deployed k8s version, just in a cluster deployment k8s racher-cluster.yml
adding system-images
section and the kubernetes
system image rancher/hyperkube
label to be found in the latest v1.17.2-rancher1
can be.
[root@prod-rancher-server-01 ~]# cd /opt/rancher/deploy/
[root@prod-rancher-server-01 deploy]# vim rancher-cluster.yml
nodes:
- address: 172.16.3.241
user: rancher
role: [ "controlplane", "etcd", "worker" ]
ssh_key_path: ~/.ssh/id_rsa
- address: 172.16.3.242
user: rancher
role: [ "controlplane", "etcd", "worker" ]
ssh_key_path: ~/.ssh/id_rsa
- address: 172.16.3.243
user: rancher
role: [ "controlplane", "etcd", "worker" ]
ssh_key_path: ~/.ssh/id_rsa
private_registries:
- url: reg.nexus.wmq.com
user: admin
password: "*******"
is_default: true
system-images:
kubernetes: rancher/hyperkube:v1.17.2-rancher1
services:
etcd:
backup_config:
enabled: true
interval_hours: 1
retention: 30
2) upload the image to the warehouse
Because before and are based on private warehouse offline Rancher service deployment, and racher-cluster.yml
designated private warehouse, so they need to upload the latest mirrored to a private warehouse. Rancher find the latest stable version v2.3.5, the version supported by default k8s version is v1.17.2, download the version of rancher-images.txt
all the images, and upload it to a private warehouse.
Download the image file list
mkdir -p /opt/rancher/upgrade2.3.5 && cd /opt/rancher/upgrade2.3.5
wget https://github.com/rancher/rancher/releases/download/v2.3.5/rancher-images.txt
Find the download upload script
See two scripts offline installation Rancher2.2.4 HA cluster in 2.1 准备文件
subsection
rancher-save-images.sh
rancher-push-images.sh
Download image
chmod +x rancher-save-images.sh
./rancher-save-images.sh --image-list /opt/rancher/upgrade2.3.5/rancher-images.txt
Synchronous mirroring
chmod +x rancher-push-images.sh
./rancher-push-images.sh
reg.nexus.wmq.com
admin
******
3) Upgrading the cluster
rke up --config ./rancher-cluster.yml
When finished, display: Finished building Kubernetes cluster successfully
reference:
https://blog.csdn.net/happyzwh/article/details/91493244
https://www.bookstack.cn/read/rancher-rke/b66a152f46b163ab.md
https://www.bookstack.cn/read/rancher-rke/41f1f9eea28e8e52.md