Kubernetes版本升级到v1.18.0方法

2023-12-13 23:25:28

升级k8s版本才能使用kube-prometheus安装监控

1、查看集群状态

[root@k8s-master k8s-script]# kubectl get nodes
NAME         STATUS   ROLES    AGE     VERSION
k8s-master   Ready    master   5d22h   v1.18.0
k8s-slave1   Ready    <none>   4d10h   v1.18.0
k8s-slave2   Ready    <none>   4d10h   v1.18.0

[root@k8s-master k8s-script]# kubectl get pods -n kube-system
NAME                                         READY   STATUS    RESTARTS   AGE
coredns-7ff77c879f-nzw77                     1/1     Running   5          5d22h
coredns-7ff77c879f-x5gc9                     1/1     Running   5          5d22h
dashboard-metrics-scraper-6b4884c9d5-8cxd8   1/1     Running   4          4d7h
etcd-k8s-master                              1/1     Running   6          5d22h
kube-apiserver-k8s-master                    1/1     Running   6          5d22h
kube-controller-manager-k8s-master           1/1     Running   7          5d22h
kube-proxy-8m9lq                             1/1     Running   6          4d10h
kube-proxy-jr72q                             1/1     Running   5          4d10h
kube-proxy-kv9n5                             1/1     Running   6          5d22h
kube-scheduler-k8s-master                    1/1     Running   7          5d22h
kubernetes-dashboard-c98496485-ch4lw         1/1     Running   4          4d7h

2、把master节点设置为不可调度

[root@k8s-master ~]# kubectl drain k8s-master --ignore-daemonsets --force
node/k8s-master already cordoned
WARNING: ignoring DaemonSet-managed Pods: kube-flannel/kube-flannel-ds-jpllk, kube-system/kube-proxy-kv9n5
evicting pod kube-system/coredns-7ff77c879f-nzw77
pod/coredns-7ff77c879f-nzw77 evicted
node/k8s-master evicted

3、把要升级的节点上的服务驱逐到别的节点上


[root@k8s-master ~]# # kubectl drain k8s-master --ignore-daemonsets --force

4、查看kueadm的所有版本

[root@k8s-master ~]# yum list kubeadm.x86_64 --showduplicates
已加载插件:fastestmirror, langpacks
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
已安装的软件包
kubeadm.x86_64                               1.18.0-0                                @kubernetes
可安装的软件包
kubeadm.x86_64                               1.6.0-0                                 kubernetes 
kubeadm.x86_64                               1.6.1-0                                 kubernetes 
kubeadm.x86_64                               1.6.2-0                                 kubernetes 
kubeadm.x86_64                               1.6.3-0                                 kubernetes 
kubeadm.x86_64                               1.6.4-0                                 kubernetes 
kubeadm.x86_64                               1.6.5-0                                 kubernetes 
kubeadm.x86_64                               1.6.6-0                                 kubernetes 
kubeadm.x86_64                               1.6.7-0                                 kubernetes 
kubeadm.x86_64                               1.6.8-0                                 kubernetes 
kubeadm.x86_64                               1.6.9-0                                 kubernetes 
kubeadm.x86_64                               1.6.10-0                                kubernetes 
kubeadm.x86_64                               1.6.11-0                                kubernetes 
kubeadm.x86_64                               1.6.12-0                                kubernetes 
kubeadm.x86_64                               1.6.13-0                                kubernetes 
kubeadm.x86_64                               1.7.0-0                                 kubernetes 
kubeadm.x86_64                               1.7.1-0                                 kubernetes 
kubeadm.x86_64                               1.7.2-0                                 kubernetes 
kubeadm.x86_64                               1.7.3-1                                 kubernetes 
kubeadm.x86_64                               1.7.4-0                                 kubernetes 
kubeadm.x86_64                               1.7.5-0                                 kubernetes 
kubeadm.x86_64                               1.7.6-1                                 kubernetes 
kubeadm.x86_64                               1.7.7-1                                 kubernetes 
kubeadm.x86_64                               1.7.8-1                                 kubernetes 
kubeadm.x86_64                               1.7.9-0                                 kubernetes 
kubeadm.x86_64                               1.7.10-0                                kubernetes 
kubeadm.x86_64                               1.7.11-0                                kubernetes 
kubeadm.x86_64                               1.7.14-0                                kubernetes 
kubeadm.x86_64                               1.7.15-0                                kubernetes 
kubeadm.x86_64                               1.7.16-0                                kubernetes 
kubeadm.x86_64                               1.8.0-0                                 kubernetes 
kubeadm.x86_64                               1.8.0-1                                 kubernetes 
kubeadm.x86_64                               1.8.1-0                                 kubernetes 
kubeadm.x86_64                               1.8.2-0                                 kubernetes 
kubeadm.x86_64                               1.8.3-0                                 kubernetes 
kubeadm.x86_64                               1.8.4-0                                 kubernetes 
kubeadm.x86_64                               1.8.5-0                                 kubernetes 
kubeadm.x86_64                               1.8.6-0                                 kubernetes 
kubeadm.x86_64                               1.8.7-0                                 kubernetes 
kubeadm.x86_64                               1.8.8-0                                 kubernetes 
kubeadm.x86_64                               1.8.9-0                                 kubernetes 
kubeadm.x86_64                               1.8.10-0                                kubernetes 
kubeadm.x86_64                               1.8.11-0                                kubernetes 
kubeadm.x86_64                               1.8.12-0                                kubernetes 
kubeadm.x86_64                               1.8.13-0                                kubernetes 
kubeadm.x86_64                               1.8.14-0                                kubernetes 
kubeadm.x86_64                               1.8.15-0                                kubernetes 
kubeadm.x86_64                               1.9.0-0                                 kubernetes 
kubeadm.x86_64                               1.9.1-0                                 kubernetes 
kubeadm.x86_64                               1.9.2-0                                 kubernetes 
kubeadm.x86_64                               1.9.3-0                                 kubernetes 
kubeadm.x86_64                               1.9.4-0                                 kubernetes 
kubeadm.x86_64                               1.9.5-0                                 kubernetes 
kubeadm.x86_64                               1.9.6-0                                 kubernetes 
kubeadm.x86_64                               1.9.7-0                                 kubernetes 
kubeadm.x86_64                               1.9.8-0                                 kubernetes 
kubeadm.x86_64                               1.9.9-0                                 kubernetes 
kubeadm.x86_64                               1.9.10-0                                kubernetes 
kubeadm.x86_64                               1.9.11-0                                kubernetes 
kubeadm.x86_64                               1.10.0-0                                kubernetes 
kubeadm.x86_64                               1.10.1-0                                kubernetes 
kubeadm.x86_64                               1.10.2-0                                kubernetes 
kubeadm.x86_64                               1.10.3-0                                kubernetes 
kubeadm.x86_64                               1.10.4-0                                kubernetes 
kubeadm.x86_64                               1.10.5-0                                kubernetes 
kubeadm.x86_64                               1.10.6-0                                kubernetes 
kubeadm.x86_64                               1.10.7-0                                kubernetes 
kubeadm.x86_64                               1.10.8-0                                kubernetes 
kubeadm.x86_64                               1.10.9-0                                kubernetes 
kubeadm.x86_64                               1.10.10-0                               kubernetes 
kubeadm.x86_64                               1.10.11-0                               kubernetes 
kubeadm.x86_64                               1.10.12-0                               kubernetes 
kubeadm.x86_64                               1.10.13-0                               kubernetes 
kubeadm.x86_64                               1.11.0-0                                kubernetes 
kubeadm.x86_64                               1.11.1-0                                kubernetes 
kubeadm.x86_64                               1.11.2-0                                kubernetes 
kubeadm.x86_64                               1.11.3-0                                kubernetes 
kubeadm.x86_64                               1.11.4-0                                kubernetes 
kubeadm.x86_64                               1.11.5-0                                kubernetes 
kubeadm.x86_64                               1.11.6-0                                kubernetes 
kubeadm.x86_64                               1.11.7-0                                kubernetes 
kubeadm.x86_64                               1.11.8-0                                kubernetes 
kubeadm.x86_64                               1.11.9-0                                kubernetes 
kubeadm.x86_64                               1.11.10-0                               kubernetes 
kubeadm.x86_64                               1.12.0-0                                kubernetes 
kubeadm.x86_64                               1.12.1-0                                kubernetes 
kubeadm.x86_64                               1.12.2-0                                kubernetes 
kubeadm.x86_64                               1.12.3-0                                kubernetes 
kubeadm.x86_64                               1.12.4-0                                kubernetes 
kubeadm.x86_64                               1.12.5-0                                kubernetes 
kubeadm.x86_64                               1.12.6-0                                kubernetes 
kubeadm.x86_64                               1.12.7-0                                kubernetes 
kubeadm.x86_64                               1.12.8-0                                kubernetes 
kubeadm.x86_64                               1.12.9-0                                kubernetes 
kubeadm.x86_64                               1.12.10-0                               kubernetes 
kubeadm.x86_64                               1.13.0-0                                kubernetes 
kubeadm.x86_64                               1.13.1-0                                kubernetes 
kubeadm.x86_64                               1.13.2-0                                kubernetes 
kubeadm.x86_64                               1.13.3-0                                kubernetes 
kubeadm.x86_64                               1.13.4-0                                kubernetes 
kubeadm.x86_64                               1.13.5-0                                kubernetes 
kubeadm.x86_64                               1.13.6-0                                kubernetes 
kubeadm.x86_64                               1.13.7-0                                kubernetes 
kubeadm.x86_64                               1.13.8-0                                kubernetes 
kubeadm.x86_64                               1.13.9-0                                kubernetes 
kubeadm.x86_64                               1.13.10-0                               kubernetes 
kubeadm.x86_64                               1.13.11-0                               kubernetes 
kubeadm.x86_64                               1.13.12-0                               kubernetes 
kubeadm.x86_64                               1.14.0-0                                kubernetes 
kubeadm.x86_64                               1.14.1-0                                kubernetes 
kubeadm.x86_64                               1.14.2-0                                kubernetes 
kubeadm.x86_64                               1.14.3-0                                kubernetes 
kubeadm.x86_64                               1.14.4-0                                kubernetes 
kubeadm.x86_64                               1.14.5-0                                kubernetes 
kubeadm.x86_64                               1.14.6-0                                kubernetes 
kubeadm.x86_64                               1.14.7-0                                kubernetes 
kubeadm.x86_64                               1.14.8-0                                kubernetes 
kubeadm.x86_64                               1.14.9-0                                kubernetes 
kubeadm.x86_64                               1.14.10-0                               kubernetes 
kubeadm.x86_64                               1.15.0-0                                kubernetes 
kubeadm.x86_64                               1.15.1-0                                kubernetes 
kubeadm.x86_64                               1.15.2-0                                kubernetes 
kubeadm.x86_64                               1.15.3-0                                kubernetes 
kubeadm.x86_64                               1.15.4-0                                kubernetes 
kubeadm.x86_64                               1.15.5-0                                kubernetes 
kubeadm.x86_64                               1.15.6-0                                kubernetes 
kubeadm.x86_64                               1.15.7-0                                kubernetes 
kubeadm.x86_64                               1.15.8-0                                kubernetes 
kubeadm.x86_64                               1.15.9-0                                kubernetes 
kubeadm.x86_64                               1.15.10-0                               kubernetes 
kubeadm.x86_64                               1.15.11-0                               kubernetes 
kubeadm.x86_64                               1.15.12-0                               kubernetes 
kubeadm.x86_64                               1.16.0-0                                kubernetes 
kubeadm.x86_64                               1.16.1-0                                kubernetes 
kubeadm.x86_64                               1.16.2-0                                kubernetes 
kubeadm.x86_64                               1.16.3-0                                kubernetes 
kubeadm.x86_64                               1.16.4-0                                kubernetes 
kubeadm.x86_64                               1.16.5-0                                kubernetes 
kubeadm.x86_64                               1.16.6-0                                kubernetes 
kubeadm.x86_64                               1.16.7-0                                kubernetes 
kubeadm.x86_64                               1.16.8-0                                kubernetes 
kubeadm.x86_64                               1.16.9-0                                kubernetes 
kubeadm.x86_64                               1.16.10-0                               kubernetes 
kubeadm.x86_64                               1.16.11-0                               kubernetes 
kubeadm.x86_64                               1.16.11-1                               kubernetes 
kubeadm.x86_64                               1.16.12-0                               kubernetes 
kubeadm.x86_64                               1.16.13-0                               kubernetes 
kubeadm.x86_64                               1.16.14-0                               kubernetes 
kubeadm.x86_64                               1.16.15-0                               kubernetes 
kubeadm.x86_64                               1.17.0-0                                kubernetes 
kubeadm.x86_64                               1.17.1-0                                kubernetes 
kubeadm.x86_64                               1.17.2-0                                kubernetes 
kubeadm.x86_64                               1.17.3-0                                kubernetes 
kubeadm.x86_64                               1.17.4-0                                kubernetes 
kubeadm.x86_64                               1.17.5-0                                kubernetes 
kubeadm.x86_64                               1.17.6-0                                kubernetes 
kubeadm.x86_64                               1.17.7-0                                kubernetes 
kubeadm.x86_64                               1.17.7-1                                kubernetes 
kubeadm.x86_64                               1.17.8-0                                kubernetes 
kubeadm.x86_64                               1.17.9-0                                kubernetes 
kubeadm.x86_64                               1.17.11-0                               kubernetes 
kubeadm.x86_64                               1.17.12-0                               kubernetes 
kubeadm.x86_64                               1.17.13-0                               kubernetes 
kubeadm.x86_64                               1.17.14-0                               kubernetes 
kubeadm.x86_64                               1.17.15-0                               kubernetes 
kubeadm.x86_64                               1.17.16-0                               kubernetes 
kubeadm.x86_64                               1.17.17-0                               kubernetes 
kubeadm.x86_64                               1.18.0-0                                kubernetes 
kubeadm.x86_64                               1.18.1-0                                kubernetes 
kubeadm.x86_64                               1.18.2-0                                kubernetes 
kubeadm.x86_64                               1.18.3-0                                kubernetes 
kubeadm.x86_64                               1.18.4-0                                kubernetes 
kubeadm.x86_64                               1.18.4-1                                kubernetes 
kubeadm.x86_64                               1.18.5-0                                kubernetes 
kubeadm.x86_64                               1.18.6-0                                kubernetes 
kubeadm.x86_64                               1.18.8-0                                kubernetes 
kubeadm.x86_64                               1.18.9-0                                kubernetes 
kubeadm.x86_64                               1.18.10-0                               kubernetes 
kubeadm.x86_64                               1.18.12-0                               kubernetes 
kubeadm.x86_64                               1.18.13-0                               kubernetes 
kubeadm.x86_64                               1.18.14-0                               kubernetes 
kubeadm.x86_64                               1.18.15-0                               kubernetes 
kubeadm.x86_64                               1.18.16-0                               kubernetes 
kubeadm.x86_64                               1.18.17-0                               kubernetes 
kubeadm.x86_64                               1.18.18-0                               kubernetes 
kubeadm.x86_64                               1.18.19-0                               kubernetes 
kubeadm.x86_64                               1.18.20-0                               kubernetes 
kubeadm.x86_64                               1.19.0-0                                kubernetes 
kubeadm.x86_64                               1.19.1-0                                kubernetes 
kubeadm.x86_64                               1.19.2-0                                kubernetes 
kubeadm.x86_64                               1.19.3-0                                kubernetes 
kubeadm.x86_64                               1.19.4-0                                kubernetes 
kubeadm.x86_64                               1.19.5-0                                kubernetes 
kubeadm.x86_64                               1.19.6-0                                kubernetes 
kubeadm.x86_64                               1.19.7-0                                kubernetes 
kubeadm.x86_64                               1.19.8-0                                kubernetes 
kubeadm.x86_64                               1.19.9-0                                kubernetes 
kubeadm.x86_64                               1.19.10-0                               kubernetes 
kubeadm.x86_64                               1.19.11-0                               kubernetes 
kubeadm.x86_64                               1.19.12-0                               kubernetes 
kubeadm.x86_64                               1.19.13-0                               kubernetes 
kubeadm.x86_64                               1.19.14-0                               kubernetes 
kubeadm.x86_64                               1.19.15-0                               kubernetes 
kubeadm.x86_64                               1.19.16-0                               kubernetes 
kubeadm.x86_64                               1.20.0-0                                kubernetes 
kubeadm.x86_64                               1.20.1-0                                kubernetes 
kubeadm.x86_64                               1.20.2-0                                kubernetes 
kubeadm.x86_64                               1.20.4-0                                kubernetes 
kubeadm.x86_64                               1.20.5-0                                kubernetes 
kubeadm.x86_64                               1.20.6-0                                kubernetes 
kubeadm.x86_64                               1.20.7-0                                kubernetes 
kubeadm.x86_64                               1.20.8-0                                kubernetes 
kubeadm.x86_64                               1.20.9-0                                kubernetes 
kubeadm.x86_64                               1.20.10-0                               kubernetes 
kubeadm.x86_64                               1.20.11-0                               kubernetes 
kubeadm.x86_64                               1.20.12-0                               kubernetes 
kubeadm.x86_64                               1.20.13-0                               kubernetes 
kubeadm.x86_64                               1.20.14-0                               kubernetes 
kubeadm.x86_64                               1.20.15-0                               kubernetes 
kubeadm.x86_64                               1.21.0-0                                kubernetes 
kubeadm.x86_64                               1.21.1-0                                kubernetes 
kubeadm.x86_64                               1.21.2-0                                kubernetes 
kubeadm.x86_64                               1.21.3-0                                kubernetes 
kubeadm.x86_64                               1.21.4-0                                kubernetes 
kubeadm.x86_64                               1.21.5-0                                kubernetes 
kubeadm.x86_64                               1.21.6-0                                kubernetes 
kubeadm.x86_64                               1.21.7-0                                kubernetes 
kubeadm.x86_64                               1.21.8-0                                kubernetes 
kubeadm.x86_64                               1.21.9-0                                kubernetes 
kubeadm.x86_64                               1.21.10-0                               kubernetes 
kubeadm.x86_64                               1.21.11-0                               kubernetes 
kubeadm.x86_64                               1.21.12-0                               kubernetes 
kubeadm.x86_64                               1.21.13-0                               kubernetes 
kubeadm.x86_64                               1.21.14-0                               kubernetes 
kubeadm.x86_64                               1.22.0-0                                kubernetes 
kubeadm.x86_64                               1.22.1-0                                kubernetes 
kubeadm.x86_64                               1.22.2-0                                kubernetes 
kubeadm.x86_64                               1.22.3-0                                kubernetes 
kubeadm.x86_64                               1.22.4-0                                kubernetes 
kubeadm.x86_64                               1.22.5-0                                kubernetes 
kubeadm.x86_64                               1.22.6-0                                kubernetes 
kubeadm.x86_64                               1.22.7-0                                kubernetes 
kubeadm.x86_64                               1.22.8-0                                kubernetes 
kubeadm.x86_64                               1.22.9-0                                kubernetes 
kubeadm.x86_64                               1.22.10-0                               kubernetes 
kubeadm.x86_64                               1.22.11-0                               kubernetes 
kubeadm.x86_64                               1.22.12-0                               kubernetes 
kubeadm.x86_64                               1.22.13-0                               kubernetes 
kubeadm.x86_64                               1.22.14-0                               kubernetes 
kubeadm.x86_64                               1.22.15-0                               kubernetes 
kubeadm.x86_64                               1.22.16-0                               kubernetes 
kubeadm.x86_64                               1.22.17-0                               kubernetes 
kubeadm.x86_64                               1.23.0-0                                kubernetes 
kubeadm.x86_64                               1.23.1-0                                kubernetes 
kubeadm.x86_64                               1.23.2-0                                kubernetes 
kubeadm.x86_64                               1.23.3-0                                kubernetes 
kubeadm.x86_64                               1.23.4-0                                kubernetes 
kubeadm.x86_64                               1.23.5-0                                kubernetes 
kubeadm.x86_64                               1.23.6-0                                kubernetes 
kubeadm.x86_64                               1.23.7-0                                kubernetes 
kubeadm.x86_64                               1.23.8-0                                kubernetes 
kubeadm.x86_64                               1.23.9-0                                kubernetes 
kubeadm.x86_64                               1.23.10-0                               kubernetes 
kubeadm.x86_64                               1.23.11-0                               kubernetes 
kubeadm.x86_64                               1.23.12-0                               kubernetes 
kubeadm.x86_64                               1.23.13-0                               kubernetes 
kubeadm.x86_64                               1.23.14-0                               kubernetes 
kubeadm.x86_64                               1.23.15-0                               kubernetes 
kubeadm.x86_64                               1.23.16-0                               kubernetes 
kubeadm.x86_64                               1.23.17-0                               kubernetes 
kubeadm.x86_64                               1.24.0-0                                kubernetes 
kubeadm.x86_64                               1.24.1-0                                kubernetes 
kubeadm.x86_64                               1.24.2-0                                kubernetes 
kubeadm.x86_64                               1.24.3-0                                kubernetes 
kubeadm.x86_64                               1.24.4-0                                kubernetes 
kubeadm.x86_64                               1.24.5-0                                kubernetes 
kubeadm.x86_64                               1.24.6-0                                kubernetes 
kubeadm.x86_64                               1.24.7-0                                kubernetes 
kubeadm.x86_64                               1.24.8-0                                kubernetes 
kubeadm.x86_64                               1.24.9-0                                kubernetes 
kubeadm.x86_64                               1.24.10-0                               kubernetes 
kubeadm.x86_64                               1.24.11-0                               kubernetes 
kubeadm.x86_64                               1.24.12-0                               kubernetes 
kubeadm.x86_64                               1.24.13-0                               kubernetes 
kubeadm.x86_64                               1.24.14-0                               kubernetes 
kubeadm.x86_64                               1.24.15-0                               kubernetes 
kubeadm.x86_64                               1.24.16-0                               kubernetes 
kubeadm.x86_64                               1.24.17-0                               kubernetes 
kubeadm.x86_64                               1.25.0-0                                kubernetes 
kubeadm.x86_64                               1.25.1-0                                kubernetes 
kubeadm.x86_64                               1.25.2-0                                kubernetes 
kubeadm.x86_64                               1.25.3-0                                kubernetes 
kubeadm.x86_64                               1.25.4-0                                kubernetes 
kubeadm.x86_64                               1.25.5-0                                kubernetes 
kubeadm.x86_64                               1.25.6-0                                kubernetes 
kubeadm.x86_64                               1.25.7-0                                kubernetes 
kubeadm.x86_64                               1.25.8-0                                kubernetes 
kubeadm.x86_64                               1.25.9-0                                kubernetes 
kubeadm.x86_64                               1.25.10-0                               kubernetes 
kubeadm.x86_64                               1.25.11-0                               kubernetes 
kubeadm.x86_64                               1.25.12-0                               kubernetes 
kubeadm.x86_64                               1.25.13-0                               kubernetes 
kubeadm.x86_64                               1.25.14-0                               kubernetes 
kubeadm.x86_64                               1.26.0-0                                kubernetes 
kubeadm.x86_64                               1.26.1-0                                kubernetes 
kubeadm.x86_64                               1.26.2-0                                kubernetes 
kubeadm.x86_64                               1.26.3-0                                kubernetes 
kubeadm.x86_64                               1.26.4-0                                kubernetes 
kubeadm.x86_64                               1.26.5-0                                kubernetes 
kubeadm.x86_64                               1.26.6-0                                kubernetes 
kubeadm.x86_64                               1.26.7-0                                kubernetes 
kubeadm.x86_64                               1.26.8-0                                kubernetes 
kubeadm.x86_64                               1.26.9-0                                kubernetes 
kubeadm.x86_64                               1.27.0-0                                kubernetes 
kubeadm.x86_64                               1.27.1-0                                kubernetes 
kubeadm.x86_64                               1.27.2-0                                kubernetes 
kubeadm.x86_64                               1.27.3-0                                kubernetes 
kubeadm.x86_64                               1.27.4-0                                kubernetes 
kubeadm.x86_64                               1.27.5-0                                kubernetes 
kubeadm.x86_64                               1.27.6-0                                kubernetes 
kubeadm.x86_64                               1.28.0-0                                kubernetes 
kubeadm.x86_64                               1.28.1-0                                kubernetes 
kubeadm.x86_64                               1.28.2-0                                kubernetes 

5、在github中查看kube-prometheus和k8s对应的版本信息,

https://github.com/prometheus-operator/kube-prometheus

如下图
在这里插入图片描述
一步到位,把k8s升级到1.28版本
下文中本来想升级到1.27,结果系统自动默认升级到1.28了

[root@k8s-master ~]# yum install kubeadm-1.27.0-0.x86_64 -y  --disableexcludes=kubernetes
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                     | 3.6 kB  00:00:00     
docker-ce-edge                                                           | 3.5 kB  00:00:00     
extras                                                                   | 2.9 kB  00:00:00     
kubernetes                                                               | 1.4 kB  00:00:00     
updates                                                                  | 2.9 kB  00:00:00     
正在解决依赖关系
--> 正在检查事务
---> 软件包 kubeadm.x86_64.0.1.18.0-0 将被 升级
---> 软件包 kubeadm.x86_64.0.1.27.0-0 将被 更新
--> 正在处理依赖关系 kubelet >= 1.19.0,它被软件包 kubeadm-1.27.0-0.x86_64 需要
--> 正在处理依赖关系 kubectl >= 1.19.0,它被软件包 kubeadm-1.27.0-0.x86_64 需要
--> 正在检查事务
---> 软件包 kubectl.x86_64.0.1.18.0-0 将被 升级
---> 软件包 kubectl.x86_64.0.1.28.2-0 将被 更新
---> 软件包 kubelet.x86_64.0.1.18.0-0 将被 升级
---> 软件包 kubelet.x86_64.0.1.28.2-0 将被 更新
--> 解决依赖关系完成

依赖关系解决

================================================================================================
 Package              架构                版本                    源                       大小
================================================================================================
正在更新:
 kubeadm              x86_64              1.27.0-0                kubernetes               11 M
为依赖而更新:
 kubectl              x86_64              1.28.2-0                kubernetes               11 M
 kubelet              x86_64              1.28.2-0                kubernetes               21 M

事务概要
================================================================================================
升级  1 软件包 (+2 依赖软件包)

总计:42 M
总下载量:11 M
Downloading packages:
No Presto metadata available for kubernetes
5757b853af7b81f977d17812620d3eef53be41fb81b208b815a0dcb6a6ab2299-kubeadm |  11 MB  00:00:17     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : kubelet-1.28.2-0.x86_64                                                     1/6 
  正在更新    : kubectl-1.28.2-0.x86_64                                                     2/6 
  正在更新    : kubeadm-1.27.0-0.x86_64                                                     3/6 
  清理        : kubeadm-1.18.0-0.x86_64                                                     4/6 
  清理        : kubectl-1.18.0-0.x86_64                                                     5/6 
  清理        : kubelet-1.18.0-0.x86_64                                                     6/6 
  验证中      : kubectl-1.28.2-0.x86_64                                                     1/6 
  验证中      : kubeadm-1.27.0-0.x86_64                                                     2/6 
  验证中      : kubelet-1.28.2-0.x86_64                                                     3/6 
  验证中      : kubectl-1.18.0-0.x86_64                                                     4/6 
  验证中      : kubelet-1.18.0-0.x86_64                                                     5/6 
  验证中      : kubeadm-1.18.0-0.x86_64                                                     6/6 

更新完毕:
  kubeadm.x86_64 0:1.27.0-0                                                                     

作为依赖被升级:
  kubectl.x86_64 0:1.28.2-0                      kubelet.x86_64 0:1.28.2-0                     

完毕!

6、重新加载重启集群

[root@k8s-master ~]# systemctl daemon-reload
[root@k8s-master ~]# systemctl restart kubelet
[root@k8s-master ~]# kubectl uncordon k8s-master
node/k8s-master uncordoned

7、查看集群节点状态,version为集群版本信息

[root@k8s-master ~]# kubectl get nodes
NAME         STATUS   ROLES    AGE     VERSION
k8s-master   Ready    master   5d23h   v1.18.0
k8s-slave1   Ready    <none>   4d11h   v1.18.0
k8s-slave2   Ready    <none>   4d11h   v1.18.0

8、查看集群所有的pod

[root@k8s-master ~]# kubectl get pods --all-namespaces
NAMESPACE      NAME                                         READY   STATUS    RESTARTS   AGE
default        nginx-5749bd847d-94zvw                       1/1     Running   3          2d1h
dev            nginx-755c49cf64-lbl25                       1/1     Running   3          2d
dev            nginx-755c49cf64-lj5nf                       1/1     Running   3          2d
dev            nginx-755c49cf64-pps2p                       1/1     Running   3          2d
kube-flannel   kube-flannel-ds-jpllk                        1/1     Running   6          4d11h
kube-flannel   kube-flannel-ds-md7hb                        1/1     Running   7          4d11h
kube-flannel   kube-flannel-ds-q428r                        1/1     Running   7          4d11h
kube-system    coredns-7ff77c879f-t4c9z                     1/1     Running   0          21m
kube-system    coredns-7ff77c879f-x5gc9                     1/1     Running   6          5d23h
kube-system    dashboard-metrics-scraper-6b4884c9d5-8cxd8   1/1     Running   5          4d8h
kube-system    etcd-k8s-master                              1/1     Running   7          5d23h
kube-system    kube-apiserver-k8s-master                    1/1     Running   7          5d23h
kube-system    kube-controller-manager-k8s-master           1/1     Running   8          5d23h
kube-system    kube-proxy-8m9lq                             1/1     Running   7          4d11h
kube-system    kube-proxy-jr72q                             1/1     Running   6          4d11h
kube-system    kube-proxy-kv9n5                             1/1     Running   7          5d23h
kube-system    kube-scheduler-k8s-master                    1/1     Running   8          5d23h
kube-system    kubernetes-dashboard-c98496485-ch4lw         1/1     Running   5          4d8h

都为Running,升级成功!

文章来源:https://blog.csdn.net/weixin_44870066/article/details/134983749
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。