Purpose
Kubelet, kubectl, kubeadm version upgrade
Work process
- 노드 업그레이드 순서 kubeadm upgrade → kubelet, kubectl upgrade
- 기본 컨트롤 플레인 노드를 업그레이드한다.
- 추가 컨트롤 플레인 노드를 업그레이드한다.
- 워커(worker) 노드를 업그레이드한다.
Master node
1. kubeadm upgrade
Check version
kubeadm version
Decision version
## yum list 에서 확인
yum list --showduplicates kubeadm --disableexcludes=kubernetes
>> 1.21.4-0
Master node drain
master $ kubectl drain controlplane --ignore-daemonsets
master $ kubectl get nodes
NAME STATUS ROLES AGE VERSION
controlplane Ready,SchedulingDisabled master 17m v1.18.0
node01 Ready <none> 17m v1.18.0
Master node upgrade
## 위에서 확인한 버전 install
yum install -y kubeadm-1.19.x-0 --disableexcludes=kubernetes
yum install -y kubeadm-1.21.4-0 --disableexcludes=kubernetes
[Y]
## upgrade plan 확인
kubeadm upgrade plan
## 업그레이드 적용 (첫 번째 컨트롤플레인 노드에서 아래 명령 실행)
kubeadm upgrade apply v1.19.0
kubeadm upgrade apply v1.21.4
## 첫번째 이후 다른 컨트롤 플레인 노드의 경우 아래명령 실행
kubeadm upgrade node
## upgrade version 확인
kubeadm version
2. kubelet, kubectl upgrade
Kubelet & Kubectl upgrade
## yum list 에서 확인
yum list --showduplicates kubelet kubectl --disableexcludes=kubernetes
>> 1.21.4-0
apt install kubelet=1.19.0-00
yum install -y kubelet-1.19.x-0 kubectl-1.19.x-0 --disableexcludes=kubernetes
yum install -y kubelet-1.21.4-0 kubectl-1.21.4-0 --disableexcludes=kubernetes
Restart kubelet
sudo systemctl daemon-reload
sudo systemctl restart kubelet
kubelet --version
kubectl version --short
Uncordon
kubectl uncordon controlplane
Worker node
1. Kubeadm upgrade
Work node drain
kubectl drain node01 --ignore-daemonsets
Worker node kubeadm upgrade
ssh node01
## controlPlane node 와 버전을 맞춘다
## install kubeadm
yum install -y kubeadm-1.19.x-0 --disableexcludes=kubernetes
yum install -y kubeadm-1.21.4-0 --disableexcludes=kubernetes
## upgrade kubeadm
kubeadm upgrade node
## check version
kubeadm version
2. kubelet, kubectl upgrade
Worker node kubelet, kubeadm upgrade
yum install -y kubelet-1.19.x-0 kubectl-1.19.x-0 --disableexcludes=kubernetes
yum install -y kubelet-1.21.4-0 kubectl-1.21.4-0 --disableexcludes=kubernetes
Restart kubelet
sudo systemctl daemon-reload
sudo systemctl restart kubelet
kubelet --version
master $ kubectl get nodes
NAME STATUS ROLES AGE VERSION
controlplane Ready master 32m v1.19.0
node01 Ready,SchedulingDisabled <none> 31m v1.19.0
Uncordon
kubectl uncordon <node-to-drain>
'Cloud-native > Kubernetes' 카테고리의 다른 글
[Kubernetes]Install Kubernetes WEB UI Dashboard (0) | 2022.05.06 |
---|---|
[Kubernetes]Install Metrics server for Kubernetes monitoring (0) | 2022.05.06 |
[Kubernetes]Drain and Delete for node change in Kubernetes (0) | 2022.05.05 |
[Kubernetes]Creating a HA cluster with kubeadm - 3.Kubeadm (0) | 2022.05.05 |
[Kubernetes]Creating a HA cluster with kubeadm - 2.HAProxy (0) | 2022.05.05 |