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!
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。