注意事项:
v1.24.0弃用了v1beta1 api 和dockershim需要提前处理

从 DOCKER SHIM 切换到 CRI DOCKERD

wget -O install.sh https://raw.githubusercontent.com/klts-io/setup-cri-dockerd/main/install.sh
chmod +x ./install.sh && ./install.sh

当前版本:

[root@master ~]# kubectl version
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.6", GitCommit:"ad3338546da947756e8a88aa6822e9c11e7eac22", GitTreeState:"clean", BuildDate:"2022-04-14T08:49:13Z", GoVersion:"go1.17.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.6", GitCommit:"ad3338546da947756e8a88aa6822e9c11e7eac22", GitTreeState:"clean", BuildDate:"2022-04-14T08:43:11Z", GoVersion:"go1.17.9", Compiler:"gc", Platform:"linux/amd64"}



当前客户端版本:

[root@master ~]# rpm -qa |grep kube
kubectl-1.23.6-0.x86_64
kubeadm-1.23.6-0.x86_64
kubernetes-cni-0.8.7-0.x86_64
kubelet-1.23.6-0.x86_64

卸载老的:

yum remove -y \
kubernetes-cni-* \
kubectl-* \
kubelet-* \
kubeadm-* 

安装客户端:

yum install -y \
kubectl  \
kubernetes-cni   \
kubelet  \
kubeadm  

最新版本:

[root@master ~]# rpm -qa |grep kube
kubectl-1.24.0-0.x86_64
kubeadm-1.24.0-0.x86_64
kubernetes-cni-0.8.7-0.x86_64
kubelet-1.24.0-0.x86_64

最新版本:

[root@master ~]# kubeadm upgrade plan
[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 -o yaml'
W0505 08:39:13.392607   52125 initconfiguration.go:120] Usage of CRI endpoints without URL scheme is deprecated and can cause kubelet errors in the future. Automatically prepending scheme "unix" to the "criSocket" with value "/var/run/dockershim.sock". Please update your configura
tion![preflight] Running pre-flight checks.
[upgrade] Running cluster health checks
[upgrade] Fetching available versions to upgrade to
[upgrade/versions] Cluster version: v1.23.6
[upgrade/versions] kubeadm version: v1.24.0
[upgrade/versions] Target version: v1.24.0
[upgrade/versions] Latest version in the v1.23 series: v1.23.6

Components that must be upgraded manually after you have upgraded the control plane with 'kubeadm upgrade apply':
COMPONENT   CURRENT       TARGET
kubelet     1 x v1.23.1   v1.24.0
            1 x v1.23.4   v1.24.0
            2 x v1.23.6   v1.24.0

Upgrade to the latest stable version:

COMPONENT                 CURRENT   TARGET
kube-apiserver            v1.23.6   v1.24.0
kube-controller-manager   v1.23.6   v1.24.0
kube-scheduler            v1.23.6   v1.24.0
kube-proxy                v1.23.6   v1.24.0
CoreDNS                   v1.8.6    v1.8.6
etcd                      3.5.1-0   3.5.3-0

You can now apply the upgrade by executing the following command:

    kubeadm upgrade apply v1.24.0

_____________________________________________________________________


The table below shows the current state of component configs as understood by this version of kubeadm.
Configs that have a "yes" mark in the "MANUAL UPGRADE REQUIRED" column require manual config upgrade or
resetting to kubeadm defaults before a successful upgrade can be performed. The version to manually
upgrade to is denoted in the "PREFERRED VERSION" column.

API GROUP                 CURRENT VERSION   PREFERRED VERSION   MANUAL UPGRADE REQUIRED
kubeproxy.config.k8s.io   v1alpha1          v1alpha1            no
kubelet.config.k8s.io     v1beta1           v1beta1             no
_____________________________________________________________________

拉取镜像,注意coredns的镜像需要tag一下

docker pull registry.aliyuncs.com/google_containers/kube-apiserver:v1.24.0
docker pull registry.aliyuncs.com/google_containers/kube-controller-manager:v1.24.0
docker pull registry.aliyuncs.com/google_containers/kube-scheduler:v1.24.0
docker pull registry.aliyuncs.com/google_containers/kube-proxy:v1.24.0
docker pull registry.aliyuncs.com/google_containers/etcd:3.5.3-0
docker pull registry.aliyuncs.com/google_containers/coredns:1.8.6
docker tag  registry.aliyuncs.com/google_containers/coredns:1.8.6 registry.aliyuncs.com/google_containers/coredns:v1.8.6

升级:

kubeadm upgrade apply v1.24.0

重启:

systemctl daemon-reload
service kubelet restart
kubectl get nodes

当前版本:

[root@master ~]# kubectl version
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.  Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.0", GitCommit:"4ce5a8954017644c5420bae81d72b09b735c21f0", GitTreeState:"clean", BuildDate:"2022-05-03T13:46:05Z", GoVersion:"go1.18.1", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v4.5.4
Server Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.0", GitCommit:"4ce5a8954017644c5420bae81d72b09b735c21f0", GitTreeState:"clean", BuildDate:"2022-05-03T13:38:19Z", GoVersion:"go1.18.1", Compiler:"gc", Platform:"linux/amd64"}

发表回复

您的电子邮箱地址不会被公开。

Captcha Code