您好,登錄后才能下訂單哦!
本篇內(nèi)容介紹了“Kubernetes 1.17.2怎么快速升級”的有關(guān)知識,在實(shí)際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!
sudo apt install kubeadm=1.17.2-00 kubectl=1.17.2-00 kubelet=1.17.2-00
設(shè)置中國區(qū)的軟件源,參考: kubernetes for china
查看該版本的容器鏡像版本:
kubeadm config images list
輸出如下:
~# kubeadm config images listk8s.gcr.io/kube-apiserver:v1.17.2k8s.gcr.io/kube-controller-manager:v1.17.2k8s.gcr.io/kube-scheduler:v1.17.2k8s.gcr.io/kube-proxy:v1.17.2k8s.gcr.io/pause:3.1k8s.gcr.io/etcd:3.4.3-0k8s.gcr.io/coredns:1.6.5
原始的kubernetes鏡像文件在gcr上,不能直接下載。我給鏡像到了阿里云的杭州機(jī)房的容器倉庫里,拉取還是比較快的。
echo ""echo "=========================================================="echo "Pull Kubernetes v1.17.2 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.2 docker pull ${MY_REGISTRY}/k8s-gcr-io-kube-controller-manager:v1.17.2 docker pull ${MY_REGISTRY}/k8s-gcr-io-kube-scheduler:v1.17.2 docker pull ${MY_REGISTRY}/k8s-gcr-io-kube-proxy:v1.17.2 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.2 k8s.gcr.io/kube-apiserver:v1.17.2 docker tag ${MY_REGISTRY}/k8s-gcr-io-kube-scheduler:v1.17.2 k8s.gcr.io/kube-scheduler:v1.17.2 docker tag ${MY_REGISTRY}/k8s-gcr-io-kube-controller-manager:v1.17.2 k8s.gcr.io/kube-controller-manager:v1.17.2 docker tag ${MY_REGISTRY}/k8s-gcr-io-kube-proxy:v1.17.2 k8s.gcr.io/kube-proxy:v1.17.2 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.2 Images FINISHED."echo "into registry.cn-hangzhou.aliyuncs.com/openthings, "echo " by openthings@https://my.oschina.net/u/2306127."echo "=========================================================="echo ""
保存為shell腳本,然后執(zhí)行。
或者,下載腳本:https://github.com/openthings/kubernetes-tools/blob/master/kubeadm/2-images/
全新安裝:
#指定IP地址,1.17.2版本:sudo kubeadm init --kubernetes-version=v1.17.2 --apiserver-advertise-address=10.1.1.199 --pod-network-cidr=10.244.0.0/16
使用kubeadm部署高可用Kubernetes 1.17.0
先查看一下需要升級的各個(gè)組件的版本。
使用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.2 8 x v1.17.1 v1.17.2 Upgrade to the latest version in the v1.17 series: COMPONENT CURRENT AVAILABLE API Server v1.17.1 v1.17.2 Controller Manager v1.17.1 v1.17.2 Scheduler v1.17.1 v1.17.2 Kube Proxy v1.17.1 v1.17.2 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.2
確保上面的容器鏡像已經(jīng)下載(如果沒有提前下載,可能被網(wǎng)絡(luò)阻隔導(dǎo)致掛起),然后執(zhí)行升級:
kubeadm upgrade -y apply v1.17.2
看到下面信息,就OK了。
[upgrade/successful] SUCCESS! Your cluster was upgraded to "v1.17.2". Enjoy!
然后,配置當(dāng)前用戶環(huán)境:
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 來查看狀態(tài)和 kubectl cluster-info 查看服務(wù)地址。
每個(gè)工作節(jié)點(diǎn)需要拉取上面對應(yīng)版本的鏡像,以及安裝kubelet的對應(yīng)版本。
檢查版本:
~$ kubectl version
查看Pod信息:
kubectl get pod --all-namespaces
“Kubernetes 1.17.2怎么快速升級”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注億速云網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。