32d12b18464568580a379bf81165cd41.png
  • 1.11.0---->1.11.9
  • master-01
  • master-02
  • master-03
  • node-01
  • 版本状态更改
  • 1.11.9-->1.12.0
  • master-01
  • master-02
  • master-03
  • node-01
  • 版本状态更改
  • 1.12.0---->1.13.5
  • master节点
  • node节点
  • 版本状态更改
  • 1.13.5 --> 1.14.2

1.11.0---->1.11.9

master-01

kubeadm upgrade planyum -y install kubeadm-1.11.9 kubernetes-cni-0.6.0.x86_64 kubelet-1.11.9kubectl get configmap -n kube-system kubeadm-config -o jsonpath={.data.MasterConfiguration} > kubeadm-config.yamlvim kubeadm-config.yaml #修改里面的参数advertiseAddress: 10.129.60.213 #本机ipkubeadm upgrade apply v1.11.9 --config kubeadm-config.yamlyum -y update kubectl-1.11.9

master-02

kubectl get configmap -n kube-system kubeadm-config -o jsonpath={.data.MasterConfiguration} > kubeadm-config.yamlvim kubeadm-config.yaml #修改里面的参数advertiseAddress: 10.129.60.213 #本机ip,让负载均衡在自己的机器上yum -y update kubeadm-1.11.9 kubernetes-cni-0.6.0.x86_64 kubelet-1.11.9kubeadm upgrade apply v1.11.9 --config kubeadm-config.yamlyum -y update kubectl-1.11.9

master-03

 kubectl get configmap -n kube-system kubeadm-config -o jsonpath={.data.MasterConfiguration} > kubeadm-config.yamlvim kubeadm-config.yaml #修改里面的参数advertiseAddress: 10.129.60.213 #本机ip,让负载均衡在自己的机器上yum -y update kubeadm-1.11.9 kubernetes-cni-0.6.0.x86_64 kubelet-1.11.9kubeadm upgrade apply v1.11.9 --config kubeadm-config.yamlyum -y update kubectl-1.11.9

node-01

yum -y update kubectl-1.11.9 kubeadm-1.11.9 kubernetes-cni-0.6.0.x86_64 kubelet-1.11.9

版本状态更改

kubectl get node #状态systemctl restart kubelet 

1.11.9-->1.12.0

master-01

#升级master-01之前需要对mysql-01进行设置禁止调度kubectl taint node master-01 node-role.kubernetes.io/master="":NoExecutekubeadm upgrade planyum -y remove kubernetes-cni-0.7.5-0.x86_64yum -y install kubeadm-1.12.0 kubernetes-cni-0.6.0-0.x86_64 kubelet-1.12.0#ps,注意:如果已经安装了kubernetes-cni-0.7.5-0.x86_64,需要先卸载掉kubernetes-cni-0.7.5-0.x86_64,再安装kubernetes-cni-0.6.0-0.x86_64#低版本可能使用的是MasterConfiguration,1.11.9以后使用的都是 ClusterConfigurationkubectl get configmap -n kube-system kubeadm-config -o jsonpath={.data.MasterConfiguration} > kubeadm-config.yaml#先拉去镜像,这里需要在kubeadm-config中配置镜像版本kubeadm config images pull --config /root/kubeadm-config.yamlvim kubeadm-config.yaml #修改里面的参数advertiseAddress: 10.129.60.213 #本机ipkubeadm upgrade apply v1.12.0 --config kubeadm-config.yaml#注意:时间比较长,如果失败了[upgrade/staticpods] This might take a minute or longer depending on the component/version gap (timeout 5m0s##查看kubelet日志,发现kubelet.go:2236] node "master-01" not found,说明docker-ce版本过低导致的,需要升级docker版本再升级kubeletyum -y update kubectl-1.12.0

master-02

#升级master-02之前需要对mysql-02进行设置禁止调度kubectl taint node master-02 node-role.kubernetes.io/master="":NoExecuteyum -y remove kubernetes-cni-0.7.5-0.x86_64yum -y install kubeadm-1.12.0 kubernetes-cni-0.6.0-0.x86_64 kubelet-1.12.0#ps,注意:如果已经安装了kubernetes-cni-0.7.5-0.x86_64,需要先卸载掉kubernetes-cni-0.7.5-0.x86_64,再安装kubernetes-cni-0.6.0-0.x86_64#低版本可能使用的是MasterConfiguration,1.11.9以后使用的都是 ClusterConfiguration,这里可能出现没有获取到kubeadm-config.yaml的问题kubectl get configmap -n kube-system kubeadm-config -o jsonpath={.data.MasterConfiguration} > kubeadm-config.yamlkubectl get configmap -n kube-system kubeadm-config -o jsonpath={.data.ClusterConfiguration} > kubeadm-config.yaml#先拉去镜像,这里需要在kubeadm-config中配置镜像版本kubeadm config images pull --config /root/kubeadm-config.yamlvim kubeadm-config.yaml #修改里面的参数advertiseAddress: 10.129.60.213 #本机ipkubeadm upgrade apply v1.12.0 --config kubeadm-config.yaml#注意:时间比较长,如果失败了[upgrade/staticpods] This might take a minute or longer depending on the component/version gap (timeout 5m0s##查看kubelet日志,发现kubelet.go:2236] node "master-01" not found,说明docker-ce版本过低导致的,需要升级docker版本再升级kubeletyum -y update docker-ce-18.06.3.ce-3.el7 yum -y update kubectl-1.12.0#开启master调度kubectl taint node --all node-role.kubernetes.io/master-

master-03

#升级master-03之前需要对mysql-03进行设置禁止调度kubectl taint node master-03 node-role.kubernetes.io/master="":NoExecuteyum -y remove kubernetes-cni-0.7.5-0.x86_64yum -y install kubeadm-1.12.0 kubernetes-cni-0.6.0-0.x86_64 kubelet-1.12.0#ps,注意:如果已经安装了kubernetes-cni-0.7.5-0.x86_64,需要先卸载掉kubernetes-cni-0.7.5-0.x86_64,再安装kubernetes-cni-0.6.0-0.x86_64#低版本可能使用的是MasterConfiguration,1.11.9以后使用的都是 ClusterConfiguration,这里可能出现没有获取到kubeadm-config.yaml的问题kubectl get configmap -n kube-system kubeadm-config -o jsonpath={.data.MasterConfiguration} > kubeadm-config.yamlkubectl get configmap -n kube-system kubeadm-config -o jsonpath={.data.ClusterConfiguration} > kubeadm-config.yaml#先拉去镜像,这里需要在kubeadm-config中配置镜像版本kubeadm config images pull --config /root/kubeadm-config.yamlvim kubeadm-config.yaml #修改里面的参数advertiseAddress: 10.129.60.213 #本机ipkubeadm upgrade apply v1.12.0 --config kubeadm-config.yaml#注意:时间比较长,如果失败了[upgrade/staticpods] This might take a minute or longer depending on the component/version gap (timeout 5m0s##查看kubelet日志,发现kubelet.go:2236] node "master-01" not found,说明docker-ce版本过低导致的,需要升级docker版本再升级kubeletyum -y update docker-ce-18.06.3.ce-3.el7 yum -y update kubectl-1.12.0#开启master调度kubectl taint node --all node-role.kubernetes.io/master-

node-01

#升级之前需要对节点进行设置禁止调度kubectl cordon node-01 #将k8s-node1节点设置为不可调度模式kubectl drain node-01 #将当前运行在k8s-node1节点上的容器驱离yum -y remove kubernetes-cni-0.7.5-0.x86_64yum -y update docker-ce-18.06.3.ce-3.el7 yum -y install kubectl-1.12.0 kubeadm-1.12.0 kubernetes-cni-0.6.0.x86_64 kubelet-1.12.0kubectl uncordon node-01 #执行完维护后,将节点重新加入调度

版本状态更改

kubectl get nodesystemctl restart kubelet 

1.12.0---->1.13.5

master节点

#如果需要升级docker的话,需要对mysql-01进行设置禁止调度kubectl taint node master-01 node-role.kubernetes.io/master="":NoExecutekubeadm upgrade planyum -y install kubeadm-1.13.5 kubernetes-cni-0.6.0-0.x86_64 kubelet-1.13.5#ps,注意:如果已经安装了kubernetes-cni-0.7.5-0.x86_64,需要先卸载掉kubernetes-cni-0.7.5-0.x86_64,再安装kubernetes-cni-0.6.0-0.x86_64#master-01节点kubeadm upgrade apply v1.13.5#其他节点:kubeadm upgrade node experimental-control-plane#注意:时间比较长,如果失败了[upgrade/staticpods] This might take a minute or longer depending on the component/version gap (timeout 5m0s##查看kubelet日志,发现kubelet.go:2236] node "master-01" not found,说明docker-ce版本过低导致的,需要升级docker版本再升级kubeletyum -y update kubectl-1.13.5

node节点

#升级之前需要对节点进行设置禁止调度kubectl cordon node-01 #将k8s-node1节点设置为不可调度模式kubectl drain node-01 #将当前运行在k8s-node1节点上的容器驱离yum -y remove kubernetes-cni-0.7.5-0.x86_64yum -y update docker-ce-18.06.3.ce-3.el7 yum -y update kubectl-1.13.5 kubeadm-1.13.5 kubernetes-cni-0.6.0.x86_64 kubelet-1.13.5kubectl uncordon node-01 #执行完维护后,将节点重新加入调度

版本状态更改

kubectl get nodesystemctl restart kubelet 

1.13.5 --> 1.14.2

#升级命令 yum -y install kubelet kubeadm kubectl  #master-01节点kubeadm upgrade apply v1.14.2#其他节点:kubeadm upgrade node experimental-control-plane#升级之前需要对节点进行设置禁止调度kubectl cordon node-01 #将k8s-node1节点设置为不可调度模式kubectl drain node-01 --ignore-daemonsets #将当前运行在k8s-node1节点上的容器驱离,不驱逐daemonsetskubectl uncordon node-01 #执行完维护后,将节点重新加入调度kubectl get nodesystemctl restart kubelet 
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐