码迷,mamicode.com
首页 > Web开发 > 详细

Kubernetes-集群升级

时间:2021-03-17 14:01:11      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:tar   image   role   can   install   chosen   RKE   rest   bec   

  • 集群版本V1.18.2
root@k8s:~# kubectl get nodes
NAME    STATUS   ROLES    AGE   VERSION
k8s     Ready    master   20d   v1.18.2
node1   Ready    worker   20d   v1.18.2
node2   Ready    worker   20d   v1.18.2
node3   Ready    worker   20d   v1.18.2
  • 将master标记为不可调度
trnuser@k8s:~$ kubectl cordon k8s
node/k8s cordoned
trnuser@k8s:~$ kubectl get nodes
NAME    STATUS                     ROLES    AGE   VERSION
k8s     Ready,SchedulingDisabled   master   20d   v1.18.2
node1   Ready                      worker   20d   v1.18.2
node2   Ready                      worker   20d   v1.18.2
node3   Ready                      worker   20d   v1.18.2
trnuser@k8s:~$
  • 安装指定版本的kubeadm,kubelet,kubectl
sudo apt install kubeadm=1.19.7-00 kubectl=1.19.7-00 kubelet=1.19.7-00 -y
  • 重启kubelet服务
systemctl restart kubelet
  • 应用升级
trnuser@k8s:~$ sudo kubeadm upgrade apply v1.19.7
[upgrade/config] Making sure the configuration is correct:
[upgrade/config] Reading configuration from the cluster...
[upgrade/config] FYI: You can look at this config file with ‘kubectl -n kube-system get cm kubeadm-config -oyaml‘
[preflight] Running pre-flight checks.
[upgrade] Running cluster health checks
[upgrade/version] You have chosen to change the cluster version to "v1.19.7"
[upgrade/versions] Cluster version: v1.18.2
[upgrade/versions] kubeadm version: v1.19.7
[upgrade/confirm] Are you sure you want to proceed with the upgrade? [y/N]: y
[upgrade/prepull] Pulling images required for setting up a Kubernetes cluster
[upgrade/prepull] This might take a minute or two, depending on the speed of your internet connection
[upgrade/prepull] You can also perform this action in beforehand using ‘kubeadm config images pull‘
...
  • 完成升级并验证
trnuser@k8s:~$ kubectl get nodes
NAME    STATUS                     ROLES    AGE   VERSION
k8s     Ready,SchedulingDisabled   master   20d   v1.19.7
node1   Ready                      worker   20d   v1.18.2
node2   Ready                      worker   20d   v1.18.2
node3   Ready                      worker   20d   v1.18.2
  • 恢复调度
trnuser@k8s:~$ kubectl uncordon k8s
node/k8s uncordoned
trnuser@k8s:~$ kubectl get nodes
NAME    STATUS   ROLES    AGE   VERSION
k8s     Ready    master   20d   v1.19.7
node1   Ready    worker   20d   v1.18.2
node2   Ready    worker   20d   v1.18.2
node3   Ready    worker   20d   v1.18.2

Kubernetes-集群升级

标签:tar   image   role   can   install   chosen   RKE   rest   bec   

原文地址:https://www.cnblogs.com/bigdad/p/14538222.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!