您好,登录后才能下订单哦!
这篇文章主要介绍“Kubernetes 1.17.1怎么快速升级”,在日常操作中,相信很多人在Kubernetes 1.17.1怎么快速升级问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”Kubernetes 1.17.1怎么快速升级”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
sudo apt install kubeadm=1.17.1-00 kubectl=1.17.1-00 kubelet=1.17.1-00
kubernetes for china
查看该版本的容器镜像版本:
kubeadm config images list
输出如下:
~# kubeadm config images listk8s.gcr.io/kube-apiserver:v1.17.1k8s.gcr.io/kube-controller-manager:v1.17.1k8s.gcr.io/kube-scheduler:v1.17.1k8s.gcr.io/kube-proxy:v1.17.1k8s.gcr.io/pause:3.1k8s.gcr.io/etcd:3.4.3-0k8s.gcr.io/coredns:1.6.5
原始的kubernetes镜像文件在gcr上,不能直接下载。我给镜像到了阿里云的杭州机房的容器仓库里,拉取还是比较快的。
echo ""echo "=========================================================="echo "Pull Kubernetes v1.17.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.17.1 docker pull ${MY_REGISTRY}/k8s-gcr-io-kube-controller-manager:v1.17.1 docker pull ${MY_REGISTRY}/k8s-gcr-io-kube-scheduler:v1.17.1 docker pull ${MY_REGISTRY}/k8s-gcr-io-kube-proxy:v1.17.1 docker pull ${MY_REGISTRY}/k8s-gcr-io-etcd:3.4.3-0 docker pull ${MY_REGISTRY}/k8s-gcr-io-pause:3.1 docker pull ${MY_REGISTRY}/k8s-gcr-io-coredns:1.6.5## 添加Tagdocker tag ${MY_REGISTRY}/k8s-gcr-io-kube-apiserver:v1.17.1 k8s.gcr.io/kube-apiserver:v1.17.1 docker tag ${MY_REGISTRY}/k8s-gcr-io-kube-scheduler:v1.17.1 k8s.gcr.io/kube-scheduler:v1.17.1 docker tag ${MY_REGISTRY}/k8s-gcr-io-kube-controller-manager:v1.17.1 k8s.gcr.io/kube-controller-manager:v1.17.1 docker tag ${MY_REGISTRY}/k8s-gcr-io-kube-proxy:v1.17.1 k8s.gcr.io/kube-proxy:v1.17.1 docker tag ${MY_REGISTRY}/k8s-gcr-io-etcd:3.4.3-0 k8s.gcr.io/etcd:3.4.3-0 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.6.5 k8s.gcr.io/coredns:1.6.5echo ""echo "=========================================================="echo "Pull Kubernetes v1.17.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/
全新安装:
#指定IP地址,1.17.1版本:sudo kubeadm init --kubernetes-version=v1.17.1 --apiserver-advertise-address=10.1.1.199 --pod-network-cidr=10.244.0.0/16
使用kubeadm部署高可用Kubernetes 1.17.0
先查看一下需要升级的各个组件的版本。
使用kubeadm upgrade plan ,输出的版本升级信息如下:
Components that must be upgraded manually after you have upgraded the control plane with 'kubeadm upgrade apply': COMPONENT CURRENT AVAILABLE Kubelet 1 x v1.17.0 v1.17.1 8 x v1.17.1 v1.17.1 Upgrade to the latest version in the v1.17 series: COMPONENT CURRENT AVAILABLE API Server v1.17.0 v1.17.1 Controller Manager v1.17.0 v1.17.1 Scheduler v1.17.0 v1.17.1 Kube Proxy v1.17.0 v1.17.1 CoreDNS 1.6.5 1.6.5 Etcd 3.4.3 3.4.3-0 You can now apply the upgrade by executing the following command: kubeadm upgrade apply v1.17.1
确保上面的容器镜像已经下载(如果没有提前下载,可能被网络阻隔导致挂起),然后执行升级:
kubeadm upgrade -y apply v1.17.1
看到下面信息,就OK了。
[upgrade/successful] SUCCESS! Your cluster was upgraded to "v1.17.1". Enjoy!
然后,配置当前用户环境:
mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config
就可以使用 kubectl version 来查看状态和 kubectl cluster-info 查看服务地址。
每个工作节点需要拉取上面对应版本的镜像,以及安装kubelet的对应版本。
检查版本:
~$ kubectl version
查看Pod信息:
kubectl get pod --all-namespaces
完成。
到此,关于“Kubernetes 1.17.1怎么快速升级”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。