본문 바로가기

자격증/CKA

[CKA] Kubernetes Upgrade

반응형

[문제]

Cluster Upgrage - only Master

upgrade system : k8s-master
Given an existing Kubernetes cluster running version 1.22.4,
upgrade all of the kubernetes control plane and node components on the master node only to version 1.23.3.
Be sure to drain the master node before upgrading it and uncordon it after the upgrade.

 

[풀이]

설치 순서 및 update 필요한 내역

Master(api, etcd, scheduler, controller..), Worker1, Woker2

 

1단계 :  containter engine(docker)

2단계 : install -> update 필요

1. Kubernetes 설치 툴 : kubeadm

2. master, worker1, worker2 - kubelet, kubectl

3. systemctl start kubelet start

3단계 : kubeadm 이용해서  

4. Master : kubeadm init

                  API, Controller, Scheduler, etcd... -> update 필요

5. Worker : kubeadm join master

 

업그레이드는 docs를 참고하여 버전에 맞게 진행 진행

https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade/

 

Upgrading kubeadm clusters

This page explains how to upgrade a Kubernetes cluster created with kubeadm from version 1.26.x to version 1.27.x, and from version 1.27.x to 1.27.y (where y > x). Skipping MINOR versions when upgrading is unsupported. For more details, please visit Versio

kubernetes.io

 

1. Determine which version to upgrade to
apt update
apt-cache madison kubeadm
 ==> yum list --showduplicates kubeadm --disableexcludes=kubernetes | tail -5
1.23.3-0

2. kubeadm upgrade
apt-mark unhold kubeadm && \
apt-get update && apt-get install -y kubeadm=1.24.1-00 && \
apt-mark hold kubeadm
  ==> yum install -y kubeadm-1.23.3-0 --disableexcludes=kubernetes
kubeadm version

3. Master component 들 업그레이드 상태를 확인
kubeadm upgrade plan v1.23.3
kubeadm upgrade apply v1.23.3
[upgrade/confirm] Are you sure you want to proceed with the upgrade? [y/N]: y

4. Drain the node : master node에서 동작되는 pod를 모두 삭제
k8s-master# exit
k8s-master$ exit
console$ kubectl drain k8s-master --ignore-daemonsets
console$ kubectl get nodes
console$ ssh k8s-master

5. Upgrade kubelet and kubectl 
apt-mark unhold kubelet kubectl && \
apt-get update && apt-get install -y kubelet=1.24.x-00 kubectl=1.24.x-00 && \
apt-mark hold kubelet kubectl
  ==> yum install -y kubelet-1.23.3-0 kubectl-1.23.3-0 --disableexcludes=kubernetes

systemctl daemon-reload
systemctl restart kubelet

6. Uncordon the node 
k8s-master# exit
k8s-master$ exit
console$ kubectl uncordon k8s-master
console$ kubectl get nodes

 

 

[참고]

- 유투브 따배씨

반응형