一、已有环境
前两天看到Kubernetes新出了1.14.0版本 ,还支持了window,所以特地找了时间,升级下我的小集群去尝尝鲜
名称 | 版本 |
---|---|
master01 | 1.13.0 |
slave01 | 1.13.0 |
slave02 | 1.13.0 |
二、升级脚本
升级前,默认大家已配置好了主、从节点的用户环境
升级脚本 master 和 worker 节点都通用,不同的地方在脚本的备注上已注明
#!/bin/bash
yum install -y kubeadm-1.14.0 kubectl-1.14.0 kubelet-1.14.0
kubeadm config images list
#k8s.gcr.io/kube-apiserver:v1.14.0
#k8s.gcr.io/kube-controller-manager:v1.14.0
#k8s.gcr.io/kube-scheduler:v1.14.0
#k8s.gcr.io/kube-proxy:v1.14.0
#k8s.gcr.io/pause:3.1
#k8s.gcr.io/etcd:3.3.10
#k8s.gcr.io/coredns:1.3.1
# 由于我在1.13.0版本时,已经有了这个repo,所以没有执行,大家想用的可以自取
# yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
## 拉取镜像
docker pull mirrorgooglecontainers/kube-apiserver:v1.14.0
docker pull mirrorgooglecontainers/kube-controller-manager:v1.14.0
docker pull mirrorgooglecontainers/kube-scheduler:v1.14.0
docker pull mirrorgooglecontainers/kube-proxy:v1.14.0
docker pull mirrorgooglecontainers/etcd:3.3.10
docker pull mirrorgooglecontainers/pause:3.1
docker pull coredns/coredns:1.3.1
## 添加Tag
docker tag docker.io/mirrorgooglecontainers/kube-apiserver:v1.14.0 k8s.gcr.io/kube-apiserver:v1.14.0
docker tag docker.io/mirrorgooglecontainers/kube-scheduler:v1.14.0 k8s.gcr.io/kube-scheduler:v1.14.0
docker tag docker.io/mirrorgooglecontainers/kube-controller-manager:v1.14.0 k8s.gcr.io/kube-controller-manager:v1.14.0
docker tag docker.io/mirrorgooglecontainers/kube-proxy:v1.14.0 k8s.gcr.io/kube-proxy:v1.14.0
docker tag docker.io/mirrorgooglecontainers/etcd:3.3.10 k8s.gcr.io/etcd:3.3.10
docker tag docker.io/mirrorgooglecontainers/pause:3.1 k8s.gcr.io/pause:3.1
docker tag docker.io/coredns/coredns:1.3.1 k8s.gcr.io/coredns:1.3.1
# 移除
docker rmi mirrorgooglecontainers/kube-apiserver:v1.14.0
docker rmi mirrorgooglecontainers/kube-controller-manager:v1.14.0
docker rmi mirrorgooglecontainers/kube-scheduler:v1.14.0
docker rmi mirrorgooglecontainers/kube-proxy:v1.14.0
docker rmi mirrorgooglecontainers/pause:3.1
docker rmi mirrorgooglecontainers/etcd:3.3.10
docker rmi coredns/coredns:1.3.1
# worker节点不需要执行 主节点执行,看到下面信息,表示升级OK了。
kubeadm upgrade apply v1.14.0
# [upgrade/successful] SUCCESS! Your cluster was upgraded to "v1.14.0". Enjoy!
# master 和 worker最后都需要重启下kubectl
systemctl daemon-reload
systemctl restart kubelet
# 查看下worker 和 master的Version ,是否为1.14.0
kubectl get nodes
#NAME STATUS ROLES AGE VERSION
#master01 Ready master 15d v1.14.0
#slave01 Ready worker 15d v1.14.0
#slave02 Ready worker 13d v1.14.0