当前位置:网站首页>Upgrade kubernetes 1.23.2 to 1.24.1
Upgrade kubernetes 1.23.2 to 1.24.1
2022-07-19 02:49:00 【Lao Duan studio】
The earlier runtime How to make use of docker Migrate to containerd,k8s 1.24 An important change from the previous version is that it has been abandoned dockershim 了 , So how can we 1.23.2 Upgrade to 1.24.1.
1. preparation
Modify the parameters of two nodes , The following steps should be in runtime After the migration .
[[email protected] ~]# kubectl edit nodes vms61.rhce.cc
hold
apiVersion: v1
kind: Node
metadata:
annotations:
kubeadm.alpha.kubernetes.io/cri-socket: /var/run/dockershim.sock
It is amended as follows
apiVersion: v1
kind: Node
metadata:
annotations:
kubeadm.alpha.kubernetes.io/cri-socket: /var/run/containerd/containerd.sock
[[email protected] ~]# kubectl edit nodes vms62.rhce.cc
Make similar changes above , Then restart on both machines kubelet
[[email protected] ~]# systemctl restart kubelet
[[email protected] ~]#
If it doesn't change , The following errors will be reported when updating .
[ERROR ImagePull]: failed to pull image registry.aliyuncs.com/google_containers/kube-apiserver:v1.24.1: output:
... Output ... error: exit status 1
2. upgrade master
1. Install first kubeadm1.24.1
[[email protected] ~]# yum install -y kubeadm-1.24.1-0 --disableexcludes=kubernetes
... Output ...
[[email protected] ~]#
2. Vacate the node vms61
[[email protected] ~]# kubectl drain vms61.rhce.cc --ignore-daemonsets
node/vms61.rhce.cc cordoned
WARNING: ignoring DaemonSet-managed Pods: kube-system/calico-node-lf6t2, kube-system/kube-proxy-mhr5g
evicting pod kube-system/coredns-6d8c4cb4d-f2vq4
evicting pod kube-system/calico-kube-controllers-78d6f96c7b-wfx5b
evicting pod kube-system/coredns-6d8c4cb4d-clll2
pod/calico-kube-controllers-78d6f96c7b-wfx5b evicted
pod/coredns-6d8c4cb4d-clll2 evicted
pod/coredns-6d8c4cb4d-f2vq4 evicted
node/vms61.rhce.cc drained
[[email protected] ~]#
3. Upgrade the components of the control node
[[email protected] ~]# kubeadm upgrade apply v1.24.1
... Output ..
[upgrade/successful] SUCCESS! Your cluster was upgraded to "v1.24.1". Enjoy!
[upgrade/kubelet] Now that your control plane is upgraded, please proceed with upgrading your kubelets if you haven't already done so.
[[email protected] ~]#
4. upgrade kubelet and kubectl To 1.24.1
[[email protected] ~]# yum install -y kubelet-1.24.1-0 kubectl-1.24.1-0 --disableexcludes=kubernetes
[[email protected] ~]#
modify kubelet Parameters
from
[[email protected] ~]# cat /var/lib/kubelet/kubeadm-flags.env
KUBELET_KUBEADM_ARGS="--network-plugin=cni --pod-infra-container-image=registry.aliyuncs.com/google_containers/pause:3.5"
[[email protected] ~]#
Change it to
[[email protected] ~]# cat /var/lib/kubelet/kubeadm-flags.env
KUBELET_KUBEADM_ARGS="--pod-infra-container-image=registry.aliyuncs.com/google_containers/pause:3.5"
[[email protected] ~]#
That is, the parameter... Is deleted here –network-plugin=cni, If this parameter is not deleted kubelet It won't start .
5. restart kubelet
[[email protected] ~]# systemctl daemon-reload; systemctl restart kubelet
[[email protected] ~]#
6. Yes vms61 perform uncordon
[[email protected] ~]# kubectl uncordon vms61.rhce.cc
node/vms61.rhce.cc uncordoned
[[email protected] ~]#
View node status .
[[email protected] ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
vms61.rhce.cc Ready control-plane 235d v1.24.1
vms62.rhce.cc Ready <none> 235d v1.23.2
[[email protected] ~]#
2. upgrade worker
1. stay worker Installation on kubeadm v1.24.1.
[[email protected] ~]# yum install -y kubeadm-1.24.1-0 --disableexcludes=kubernetes
[[email protected] ~]#
stay master(vms61) Empty node vms62
[[email protected] ~]# kubectl drain vms62.rhce.cc --ignore-daemonsets
node/vms62.rhce.cc cordoned
WARNING: ignoring DaemonSet-managed Pods: kube-system/calico-node-hth7g, kube-system/kube-proxy-zdhtx
evicting pod kube-system/coredns-6d8c4cb4d-rzqfm
evicting pod default/web1-665f6b46cb-jgzp8
evicting pod kube-system/calico-kube-controllers-78d6f96c7b-8nfvs
evicting pod kube-system/coredns-6d8c4cb4d-mnjwm
evicting pod default/web1-665f6b46cb-fl9b4
pod/web1-665f6b46cb-jgzp8 evicted
pod/web1-665f6b46cb-fl9b4 evicted
pod/calico-kube-controllers-78d6f96c7b-8nfvs evicted
pod/coredns-6d8c4cb4d-rzqfm evicted
pod/coredns-6d8c4cb4d-mnjwm evicted
node/vms62.rhce.cc drained
[[email protected] ~]#
2. Switch to vms62 Upgrade on kubelet To configure
[[email protected] ~]# kubeadm upgrade node
[upgrade] Reading configuration from the cluster...
[upgrade] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
[preflight] Running pre-flight checks
[preflight] Skipping prepull. Not a control plane node.
[upgrade] Skipping phase. Not a control plane node.
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[upgrade] The configuration for this node was successfully updated!
[upgrade] Now you should go ahead and upgrade the kubelet package using your package manager.
[[email protected] ~]#
modify kubelet The variable file , from
[[email protected] ~]# cat /var/lib/kubelet/kubeadm-flags.env
KUBELET_KUBEADM_ARGS="--network-plugin=cni --pod-infra-container-image=registry.aliyuncs.com/google_containers/pause:3.5"
[[email protected] ~]#
Change it to
[[email protected] ~]# cat /var/lib/kubelet/kubeadm-flags.env
KUBELET_KUBEADM_ARGS="--pod-infra-container-image=registry.aliyuncs.com/google_containers/pause:3.5"
[[email protected] ~]#
That is, the parameter... Is deleted here –network-plugin=cni .
3. upgrade kubelet and kubectl
[[email protected] ~]# yum install -y kubelet-1.24.1-0 kubectl-1.24.1-0 --disableexcludes=kubernetes
[[email protected] ~]#
4. restart kubelet
[[email protected] ~]# systemctl daemon-reload; systemctl restart kubelet
5. Release right vms62 The protection of the
Switch to vms61 Yes vms62 perform uncordon operation
[[email protected] ~]# kubectl uncordon vms62.rhce.cc
node/vms62.rhce.cc uncordoned
[[email protected] ~]#
3. verification
View node status
[[email protected] ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
vms61.rhce.cc Ready control-plane 235d v1.24.1
vms62.rhce.cc Ready <none> 235d v1.24.1
[[email protected] ~]#
see pod
[[email protected] ~]# kubectl get pods
NAME READY STATUS RESTARTS AGE
web1-665f6b46cb-g9kcl 1/1 Running 0 4m46s
web1-665f6b46cb-q8db5 1/1 Running 0 4m47s
[[email protected] ~]#
边栏推荐
- DHCP服务
- squid代理服务部署
- rsync远程同步(增量备份)
- Yum warehouse service and PXE automatic deployment system
- YUM仓库服务与PXE自动部署系统
- status 500 reading AftersaleService#getAftersaleList(Long)+com. sun. proxy.$ Proxy214.getAftersaleList
- Swagger -- the most popular API framework in the world
- 数组、冒泡的认识
- MySQL backup and recovery
- DNS域名解析
猜你喜欢
随机推荐
Leetcode 198:House Robber
Dynamic programming problem - Small Soldiers rush forward
Use JMeter to test services based on websocket protocol
Regular and extended expressions, sed text processor and awk tool, changing IP address with script
[unity Editor Extension] find all objects of a script attached in the scene and resources
单片机之数码管秒表的动态显示
Flask template injection
Sigaga
HCIP第一天_HCIA复习
JMeter response time test component & multi interface concurrency
Common English business mail phrases
C语言回调函数 & sprinf 实际应用一例
shell脚本接收和返回参数
RHCE8学习指南第2章 基本命令的使用
备份kubernetes 备份etcd数据
High quality subroutine
Shell script for, while loop statements, price guessing games
A practical case of redisson's implementation of distributed locks - lock single key - lock multiple keys - watchdog
时间管理方法的反思与探讨
Metersphere is based on JMeter distributed performance pressure testing platform








