重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
云计算
1、查看该版本的容器镜像版本:
kubeadm config images list
输出如下:
~# 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
2、拉取容器镜像
原始的kubernetes镜像文件在gcr上,不能直接下载。下面是阿里云上的资源,所有主机上都执行一下(master和node上都执行该脚本)。
echo
echo ==========================================================
echo Pull Kubernetes v1.14.0 Images from aliyuncs.com ......
echo ==========================================================
echo
MY_REGISTRY=registry.cn-hangzhou.aliyuncs.com/openthings
## 拉取镜像
docker pull ${MY_REGISTRY}/k8s-gcr-io-kube-apiserver:v1.14.0
docker pull ${MY_REGISTRY}/k8s-gcr-io-kube-controller-manager:v1.14.0
docker pull ${MY_REGISTRY}/k8s-gcr-io-kube-scheduler:v1.14.0
docker pull ${MY_REGISTRY}/k8s-gcr-io-kube-proxy:v1.14.0
docker pull ${MY_REGISTRY}/k8s-gcr-io-etcd:3.3.10
docker pull ${MY_REGISTRY}/k8s-gcr-io-pause:3.1
docker pull ${MY_REGISTRY}/k8s-gcr-io-coredns:1.3.1
## 添加Tag
docker tag ${MY_REGISTRY}/k8s-gcr-io-kube-apiserver:v1.14.0 k8s.gcr.io/kube-apiserver:v1.14.0
docker tag ${MY_REGISTRY}/k8s-gcr-io-kube-scheduler:v1.14.0 k8s.gcr.io/kube-scheduler:v1.14.0
docker tag ${MY_REGISTRY}/k8s-gcr-io-kube-controller-manager:v1.14.0 k8s.gcr.io/kube-controller-manager:v1.14.0
docker tag ${MY_REGISTRY}/k8s-gcr-io-kube-proxy:v1.14.0 k8s.gcr.io/kube-proxy:v1.14.0
docker tag ${MY_REGISTRY}/k8s-gcr-io-etcd:3.3.10 k8s.gcr.io/etcd:3.3.10
docker tag ${MY_REGISTRY}/k8s-gcr-io-pause:3.1 k8s.gcr.io/pause:3.1
docker tag ${MY_REGISTRY}/k8s-gcr-io-coredns:1.3.1 k8s.gcr.io/coredns:1.3.1
docker rmi ${MY_REGISTRY}/k8s-gcr-io-kube-apiserver:v1.14.0
docker rmi ${MY_REGISTRY}/k8s-gcr-io-kube-controller-manager:v1.14.0
docker rmi ${MY_REGISTRY}/k8s-gcr-io-kube-scheduler:v1.14.0
docker rmi ${MY_REGISTRY}/k8s-gcr-io-kube-proxy:v1.14.0
docker rmi ${MY_REGISTRY}/k8s-gcr-io-etcd:3.3.10
docker rmi ${MY_REGISTRY}/k8s-gcr-io-pause:3.1
docker rmi ${MY_REGISTRY}/k8s-gcr-io-coredns:1.3.1
echo
echo ==========================================================
echo Pull Kubernetes v1.14.0 Images FINISHED.
echo into registry.cn-hangzhou.aliyuncs.com/openthings,
echo ==========================================================
echo
保存为shell脚本,然后执行。
3、升级Kubernetes集群
先查看一下需要升级的各个组件的版本。
使用kubeadm upgrade plan
,输出的版本升级信息如下:
COMPONENT CURRENT AVAILABLE
API Server v1.13.4 v1.14.0
Controller Manager v1.13.4 v1.14.0
Scheduler v1.13.4 v1.14.0
Kube Proxy v1.13.4 v1.14.0
CoreDNS 1.2.6 1.3.1
Etcd 3.2.24 3.3.10
确保上面的容器镜像已经下载(如果没有提前下载,可能被网络阻隔导致挂起),然后在master上执行升级(我使用的是1个master,2个node的模式。如果是多个master需要在所有master上执行):kubeadm upgrade -y apply v1.14.0
看到下面信息,就OK了。[upgrade/successful] SUCCESS! Your cluster was upgraded to v1.14.0. Enjoy!