新网创想网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
这篇文章主要为大家展示了“Kubernetes 1.12.1如何快速升级”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“Kubernetes 1.12.1如何快速升级”这篇文章吧。
鹤庆ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为创新互联建站的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:18980820575(备注:SSL证书合作)期待与您的合作!
Kubernetes 1.12.1快速升级,包括升级kubeadm/kubectl/kubelet版本、拉取镜像、升级Kubernetes集群三个主要步骤。
sudo apt install kubeadm=1.12.1-00 kubectl=1.12.1-00 kubelet=1.12.1-00
查看该版本的容器镜像版本:
kubeadm config images list
输出如下:
~# kubeadm config images list k8s.gcr.io/kube-apiserver:v1.12.1 k8s.gcr.io/kube-controller-manager:v1.12.1 k8s.gcr.io/kube-scheduler:v1.12.1 k8s.gcr.io/kube-proxy:v1.12.1 k8s.gcr.io/pause:3.1 k8s.gcr.io/etcd:3.2.24 k8s.gcr.io/coreDNS:1.2.2
我给镜像到了杭州机房的容器仓库里,拉取还是比较快的。
echo "" echo "==========================================================" echo "Pull Kubernetes v1.12.1 Images from aliyuncs.com ......" echo "==========================================================" echo "" MY_REGISTRY=registry.cn-hangzhou.aliyuncs.com/openthings ## 拉取镜像 docker pull ${MY_REGISTRY}/k8s-gcr-io-kube-apiserver:v1.12.1 docker pull ${MY_REGISTRY}/k8s-gcr-io-kube-controller-manager:v1.12.1 docker pull ${MY_REGISTRY}/k8s-gcr-io-kube-scheduler:v1.12.1 docker pull ${MY_REGISTRY}/k8s-gcr-io-kube-proxy:v1.12.1 docker pull ${MY_REGISTRY}/k8s-gcr-io-etcd:3.2.24 docker pull ${MY_REGISTRY}/k8s-gcr-io-pause:3.1 docker pull ${MY_REGISTRY}/k8s-gcr-io-coredns:1.2.2 ## 添加Tag docker tag ${MY_REGISTRY}/k8s-gcr-io-kube-apiserver:v1.12.1 k8s.gcr.io/kube-apiserver:v1.12.1 docker tag ${MY_REGISTRY}/k8s-gcr-io-kube-scheduler:v1.12.1 k8s.gcr.io/kube-scheduler:v1.12.1 docker tag ${MY_REGISTRY}/k8s-gcr-io-kube-controller-manager:v1.12.1 k8s.gcr.io/kube-controller-manager:v1.12.1 docker tag ${MY_REGISTRY}/k8s-gcr-io-kube-proxy:v1.12.1 k8s.gcr.io/kube-proxy:v1.12.1 docker tag ${MY_REGISTRY}/k8s-gcr-io-etcd:3.2.24 k8s.gcr.io/etcd:3.2.24 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.2.2 k8s.gcr.io/coredns:1.2.2 echo "" echo "==========================================================" echo "Pull Kubernetes v1.12.1 Images FINISHED." echo "into registry.cn-hangzhou.aliyuncs.com/openthings, " echo " by openthings@https://my.oschina.net/u/2306127." echo "==========================================================" echo ""
保存为shell脚本,然后执行。
或者,下载脚本:https://github.com/openthings/kubernetes-tools/blob/master/kubeadm/2-images/
先查看一下需要升级的各个组件的版本。
使用kubeadm upgrade plan,输出的版本升级信息如下:
COMPONENT CURRENT AVAILABLE API Server v1.11.2 v1.12.1 Controller Manager v1.11.2 v1.12.1 Scheduler v1.11.2 v1.12.1 Kube Proxy v1.11.2 v1.12.1 CoreDNS 1.1.3 1.2.2 Etcd 3.2.18 3.2.24
确保上面的容器镜像已经下载(如果没有提前下载,可能被网络阻隔导致挂起),然后执行升级:
kubeadm upgrade apply v1.12.1
看到下面信息,就OK了。
[upgrade/successful] SUCCESS! Your cluster was upgraded to "v1.12.1". Enjoy!
每个工作节点需要拉取上面对应版本的镜像,以及安装kubelet的对应版本。
~$ kubectl version Client Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.1", GitCommit:"4ed3216f3ec431b140b1d899130a69fc671678f4", GitTreeState:"clean", BuildDate:"2018-10-05T16:46:06Z", GoVersion:"go1.10.4", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.1", GitCommit:"4ed3216f3ec431b140b1d899130a69fc671678f4", GitTreeState:"clean", BuildDate:"2018-10-05T16:36:14Z", GoVersion:"go1.10.4", Compiler:"gc", Platform:"linux/amd64"}
Get Pod
kubectl get pod --all-namespaces
view list.
以上是“Kubernetes 1.12.1如何快速升级”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联行业资讯频道!