Rancher upgrade K8S cluster deployment rke

Before use Rancher service is installed inside the cluster k8s rke deployed, i.e., the cluster Rancher UImaster interface display localcluster. 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.1version.

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.2version.

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.ymladding system-imagessection and the kubernetessystem image rancher/hyperkubelabel to be found in the latest v1.17.2-rancher1can 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.ymldesignated 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.txtall 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

Guess you like

Origin www.cnblogs.com/weavepub/p/12341945.html