본문 바로가기

자격증/CKA

CKA - Section 6: Cluster Maintenance

Section 6: Cluster Maintenance


118. Cluster Maintenance - Section Introduction

클러스터 유지

운영체제 업그레이드

 

119. Download Presentation Deck


120. OS Upgrades

클러스터의 일부인 노드를 중단해야하는 시나리오

기본 소프트웨어 업그레이드 또는 보안 패치와 같은 패치 적용 같은 유지 관리 목적

포드가 온라인 상태가 될 때까지 기다리는 시간을 포드 제거 시간 초과이며 5분

 

노드를 비울 때 

 > kubectl drain node-1

> kubectl cordon node-1

: 노드를 예약할 수 없음으로 표시함 / drain과 달리 기존 노드에서 포드를 종료하거나 이동하지 않음

  단순히 노드에 새 포드가 예약되지 않았는지를 확인함

 

> kubectl uncordon node-1

 

121. Practice Test - OS Upgrades

> kubectl drain node01 --ignore-daemonsets

> kubectl drain node02 --ignore-daemonsets --force

> kubectl cordon node03


122. Solution - OS Upgrades (optional)


123. Kubernetes Software Versions

kubernetes 릴리스 및 버전에 대해서 논의

124. References


125. Cluster Upgrade Process

kube-apiserver

Controller-manager

kube-scheduler

kubelet

kube-proxy

kubectl

 

> kubeadm upgrade plan

> apt-get upgrade -y kubeadm=1.12.0-00

> kubeadm upgrade apply v1.12.0

> kubectl get nodes 

 

> apt-get upgrade -y kubelet=1.12.0-00

> systemctl restart kubelet

> kubectl get nodes

 

kubeadm - upgrade

> kubectl drain node-1

> kubectl uncordon node-1

 

> apt-get upgrade -y kubeadm=1.12.0-00

> apt-get upgrade -y kubelet=1.12.0-00

> kubeadm upgrade node config --kubelet-version v1.12.0

> systemctl restart kubelet

 

126. Demo - Cluster upgrade
127. Practice Test - Cluster Upgrade

 

128. Solution: Cluster Upgrade

> kubeadm version

> apt install kubeadm=1.19.0-00

> kubeadm upgrade apply v1.19.0

> kubectl version --short

> apt install kubelet=1.19.0-00

 

> ssh node0

> logout


129. Backup and Restore Methods

백업 및 복원 방법

Imperative

Declarative

 

Backup - Resource Configs

Backup - ETCD

backup

etcd.service / snapshot save snapshot.db

 

restore

> service kube-apiserver stop

snapshot restore snapshot.db --data-dir /var/lib/etcd-from-backup

> systemctl deamon-reload

> service etcd restart

> service kube-apiserver start

 

130. Working with ETCDCTL

etcdctl is a command line client for etcd.

 

> export ETCD_API=3

> etcdctl snapshot save -h

> etcdctl snapshot restore -h

 

131. Practice Test - Backup and Restore Methods
132. Solution - Backup and Restore

ETCDCTL_API=3 etcdctl --endpoints=https://[127.0.0.1]:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt \
>      --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key \
>      snapshot save /opt/snapshot-pre-boot.db

> ETCDCTL_API=3 etcdctl snapshot status /opt/snapshot-pre-boot.db.

 

restore

ETCDCTL_API=3 etcdctl  --data-dir /var/lib/etcd-from-backup \
     snapshot restore /opt/snapshot-pre-boot.db

> cd etc/kubernetes/manifests/etcd.yaml

 

etcd.yaml

- hostPath:

    path: /var/lib/etcd => /var/lib/etcd-from-backup 으로 수정

 

docker ps -a | grep etcd

docker logs []

 

133. Certification Exam Tip!

> kubectl describe pod

 

134. References

'자격증 > CKA' 카테고리의 다른 글

CKA - Section 5: Application Lifecycle Management  (0) 2021.03.15
CKA - Section 4: Logging & Monitoring  (0) 2021.03.05
CKA - Section 3: Scheduling  (0) 2021.03.02
CKA - Section 2: Core Concepts  (0) 2021.02.16