Skip to content

Instantly share code, notes, and snippets.

@yangl
Last active November 15, 2018 09:18
Show Gist options
  • Save yangl/c034e1b0d47136de4ff4a2295f785af5 to your computer and use it in GitHub Desktop.
Save yangl/c034e1b0d47136de4ff4a2295f785af5 to your computer and use it in GitHub Desktop.
k8s机群版本升级

yum -y update (all)

kubeadm config images list (主)

k8s.gcr.io/kube-apiserver:v1.12.2
k8s.gcr.io/kube-controller-manager:v1.12.2
k8s.gcr.io/kube-scheduler:v1.12.2
k8s.gcr.io/kube-proxy:v1.12.2
k8s.gcr.io/pause:3.1
k8s.gcr.io/etcd:3.2.24
k8s.gcr.io/coredns:1.2.2

vi pull_k8s_images.sh (all)

#!/bin/bash

# kubeadm config images list

images=(
kube-apiserver:v1.12.2
kube-controller-manager:v1.12.2
kube-scheduler:v1.12.2
kube-proxy:v1.12.2
pause:3.1
etcd:3.2.24
coredns:1.2.2)

for imageName in ${images[@]} ; do
 docker pull anjia0532/google-containers.$imageName
 docker tag anjia0532/google-containers.$imageName k8s.gcr.io/$imageName
 docker rmi anjia0532/google-containers.$imageName
done

kubeadm upgrade plan (主)

[preflight] Running pre-flight checks.
[upgrade] Making sure the cluster is healthy:
[upgrade/config] Making sure the configuration is correct:
[upgrade/config] Reading configuration from the cluster...
[upgrade/config] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
[upgrade] Fetching available versions to upgrade to
[upgrade/versions] Cluster version: v1.11.0
[upgrade/versions] kubeadm version: v1.12.2
[upgrade/versions] Latest stable version: v1.12.2
[upgrade/versions] Latest version in the v1.11 series: v1.11.4

Components that must be upgraded manually after you have upgraded the control plane with 'kubeadm upgrade apply':
COMPONENT CURRENT AVAILABLE
Kubelet 4 x v1.11.3 v1.11.4
1 x v1.12.2 v1.11.4

Upgrade to the latest version in the v1.11 series:

COMPONENT CURRENT AVAILABLE
API Server v1.11.0 v1.11.4
Controller Manager v1.11.0 v1.11.4
Scheduler v1.11.0 v1.11.4
Kube Proxy v1.11.0 v1.11.4
CoreDNS 1.2.2 1.2.2
Etcd 3.2.18 3.2.18

You can now apply the upgrade by executing the following command:

kubeadm upgrade apply v1.11.4

_____________________________________________________________________

Components that must be upgraded manually after you have upgraded the control plane with 'kubeadm upgrade apply':
COMPONENT CURRENT AVAILABLE
Kubelet 4 x v1.11.3 v1.12.2
1 x v1.12.2 v1.12.2

Upgrade to the latest stable version:

COMPONENT CURRENT AVAILABLE
API Server v1.11.0 v1.12.2
Controller Manager v1.11.0 v1.12.2
Scheduler v1.11.0 v1.12.2
Kube Proxy v1.11.0 v1.12.2
CoreDNS 1.2.2 1.2.2
Etcd 3.2.18 3.2.24

You can now apply the upgrade by executing the following command:

kubeadm upgrade apply v1.12.2

_____________________________________________________________________

kubeadm upgrade apply v1.12.2 (主)

[upgrade/successful] SUCCESS! Your cluster was upgraded to "v1.12.2". Enjoy!

[upgrade/kubelet] Now that your control plane is upgraded, please proceed with upgrading your kubelets if you haven't already done so.

systemctl restart kubelet (从)

kubectl get nodes -o wide

NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
master Ready master 58d v1.12.2 172.16.0.9 <none> CentOS Linux 7 (Core) 3.10.0-862.14.4.el7.x86_64 docker://1.13.1
node1 Ready <none> 58d v1.12.2 172.16.0.15 <none> CentOS Linux 7 (Core) 3.10.0-862.11.6.el7.x86_64 docker://1.13.1
node2 Ready <none> 58d v1.12.2 172.16.0.10 <none> CentOS Linux 7 (Core) 3.10.0-862.11.6.el7.x86_64 docker://1.13.1
node3 Ready <none> 51d v1.12.2 172.16.0.17 <none> CentOS Linux 7 (Core) 3.10.0-862.11.6.el7.x86_64 docker://1.13.1
node4 Ready <none> 51d v1.12.2 172.16.0.2 <none> CentOS Linux 7 (Core) 3.10.0-862.11.6.el7.x86_64 docker://1.13.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment