k8s 1.13.4升级到1.14.6

1.镜像准备

镜像准备(注意,提前在所有节点都下载好镜像,不然coredns kube-proxy 这些pod会自动安装安装不上 )

master节点粘贴下面脚本,下载镜像:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
registry_host=reg.qingye.info
version=v1.14.6
pause_version=3.1
etcd_version=3.3.10
coredns_version=1.3.1
#镜像下载
docker pull $registry_host/library/kube-apiserver:$version
docker pull $registry_host/library/kube-controller-manager:$version
docker pull $registry_host/library/kube-scheduler:$version
docker pull $registry_host/library/kube-proxy:$version
docker pull $registry_host/library/pause:$pause_version
docker pull $registry_host/library/etcd:$etcd_version
docker pull $registry_host/library/coredns:$coredns_version
#镜像打tag
docker tag $registry_host/library/kube-apiserver:$version k8s.gcr.io/kube-apiserver:$version
docker tag $registry_host/library/kube-controller-manager:$version k8s.gcr.io/kube-controller-manager:$version
docker tag $registry_host/library/kube-scheduler:$version k8s.gcr.io/kube-scheduler:$version
docker tag $registry_host/library/kube-proxy:$version k8s.gcr.io/kube-proxy:$version
docker tag $registry_host/library/pause:$pause_version k8s.gcr.io/pause:$pause_version
docker tag $registry_host/library/etcd:$etcd_version k8s.gcr.io/etcd:$etcd_version
docker tag $registry_host/library/coredns:$coredns_version k8s.gcr.io/coredns:$coredns_version

node节点粘贴下面脚本,下载镜像:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash
registry_host=reg.qingye.info
version=v1.14.6
pause_version=3.1
etcd_version=3.3.10
coredns_version=1.3.1
#镜像下载
docker pull $registry_host/library/kube-proxy:$version
docker pull $registry_host/library/pause:$pause_version
docker pull $registry_host/library/etcd:$etcd_version
docker pull $registry_host/library/coredns:$coredns_version
#镜像打tag
docker tag $registry_host/library/kube-proxy:$version k8s.gcr.io/kube-proxy:$version
docker tag $registry_host/library/pause:$pause_version k8s.gcr.io/pause:$pause_version
docker tag $registry_host/library/etcd:$etcd_version k8s.gcr.io/etcd:$etcd_version
docker tag $registry_host/library/coredns:$coredns_version k8s.gcr.io/coredns:$coredns_version

2.升级master节点

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#升级第一个master节点
#安装 kubelet kubeadm 包 (我们本地有yum源,包已经提前更新到yum源)
yum install kubeadm-1.14.6-0 kubelet-1.14.6-0 --disableexcludes=kubernetes
#执行
sudo kubeadm upgrade plan 查看可安装哪个版本,我们这里安装1.14.6
kubeadm upgrade apply v1.14.6

#安装kubectl
yum install kubectl-1.14.6-0 --disableexcludes=kubernetes
#重启kubelet
systemctl daemon-reload
sudo systemctl restart kubelet

#其他master节点升级:
#安装 kubelet kubeadm 包 (我们本地有yum源,包已经提前更新到yum源)
yum install kubeadm-1.14.6-0 kubelet-1.14.6-0 --disableexcludes=kubernetes
sudo kubeadm upgrade node experimental-control-plane
yum install kubectl-1.14.6-0 --disableexcludes=kubernetes
systemctl daemon-reload
sudo systemctl restart kubelet

3.升级node节点

1
2
3
4
5
6
7
8
9
10
11
12
#工作节点的升级
#在工作节点安装新版kubeadm kubelet
yum install kubeadm-1.14.6-0 kubelet-1.14.6-0 --disableexcludes=kubernetes
#在master节点驱逐当前工作节点
kubectl drain $NODE --ignore-daemonsets
#在工作节点更新kubelet配置,重启服务
sudo kubeadm upgrade node config --kubelet-version v1.14.6
yum install -y kubectl-1.14.6-0 --disableexcludes=kubernetes
systemctl daemon-reload
sudo systemctl restart kubelet
#在master节点把对应节点允许调度
kubectl uncordon $NODE
# 推荐文章
  1.深刻理解Docker镜像大小
  2.k8s专题[1.k8s基础概念]
  3.k8s专题[10.使用Spinnaker持续发布应用]
  4.k8s专题[2.k8s设计原则]
  5.k8s专题[3.k8s基础组件]

评论


:D 一言句子获取中...