1、检查集群可更新到的最新正式版
这步需要访问google上的文件,被Wall,超时
I0215 11:50:19.097435 24591 version.go:94] could not fetch a Kubernetes version from the internet: unable to get URL "https://dl.k8s.io/release/stable.txt": Get https://storage.googleapis.com/kubernetes-release/release/stable.txt: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
2、直接在master节点升级kubeadm,kubelet,kubectl
sudo yum install kubeadm kubelet kubectl
3、再次检查可以升级到哪个版本
通过下面信息可以看出目前的版本是v1.13.3
,可以升级到的最新版本是v1.14.1
$ sudo kubeadm upgrade plan
[preflight] Running pre-flight checks.
[upgrade] Making sure the cluster is healthy:
[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'
[upgrade] Fetching available versions to upgrade to
[upgrade/versions] Cluster version: v1.13.3
[upgrade/versions] kubeadm version: v1.14.1
I0508 11:57:25.991569 31894 version.go:96] could not fetch a Kubernetes version from the internet: unable to get URL "https://dl.k8s.io/release/stable.txt": Get https://dl.k8s.io/release/stable.txt: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
I0508 11:57:25.991643 31894 version.go:97] falling back to the local client version: v1.14.1
[upgrade/versions] Latest stable version: v1.14.1
I0508 11:57:36.077088 31894 version.go:96] could not fetch a Kubernetes version from the internet: unable to get URL "https://dl.k8s.io/release/stable-1.13.txt": Get https://dl.k8s.io/release/stable-1.13.txt: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
I0508 11:57:36.077123 31894 version.go:97] falling back to the local client version: v1.14.1
[upgrade/versions] Latest version in the v1.13 series: v1.14.1
Components that must be upgraded manually after you have upgraded the control plane with 'kubeadm upgrade apply':
COMPONENT CURRENT AVAILABLE
Kubelet 3 x v1.13.3 v1.14.1
Upgrade to the latest version in the v1.13 series:
COMPONENT CURRENT AVAILABLE
API Server v1.13.3 v1.14.1
Controller Manager v1.13.3 v1.14.1
Scheduler v1.13.3 v1.14.1
Kube Proxy v1.13.3 v1.14.1
CoreDNS 1.2.6 1.3.1
Etcd 3.2.24 3.3.10
You can now apply the upgrade by executing the following command:
kubeadm upgrade apply v1.14.1
_____________________________________________________________________
4、升级集群
sudo kubeadm upgrade apply v1.14.1
5、所有node节点升级kubeadm,kubelet,并重启kubelet
sudo yum install -y kubeadm kubelet kubectl
sudo systemctl restart kubelet
6、升级kubelet的配置
sudo kubeadm upgrade node config --kubelet-version v1.14.1
7、查看
$ kubectl get node
NAME STATUS ROLES AGE VERSION
k8s-master-45 Ready master 167d v1.14.1
k8s-work-46 Ready worker 167d v1.14.1
k8s-work-47 Ready worker 167d v1.14.1
8、升级网络组件
$ kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
其他组件根据对应的yaml文件看是否需要升级
9、参考
原文地址:https://www.cnblogs.com/knmax/p/12141588.html
时间: 2024-10-08 21:15:39