Hello World!

k8s - CKA 예제 문제 Etcd backup & Restore

by PyTong

대표적인 문제로 쿠버네티스의 모든 데이터가 모여 있는 etcd를 백업하고 

 

전에 백업한 데이터로 되돌리는 작업이다.

 

쿠버네티스 문서

https://kubernetes.io/docs/tasks/administer-cluster/configure-upgrade-etcd/#backing-up-an-etcd-cluster

 

Operating etcd clusters for Kubernetes

etcd is a consistent and highly-available key value store used as Kubernetes' backing store for all cluster data. If your Kubernetes cluster uses etcd as its backing store, make sure you have a back up plan for those data. You can find in-depth information

kubernetes.io

https://www.youtube.com/watch?v=dv_5WCYS5P8 

 

기본 etcd의 경로이다

/var/lib/etcd

 

 

다음 명령어를 통해 현재 etcd의 상태를 저장할 수 있고

Sudo ETCDCTL_API=3 etcdctl \
  --endpoints=https://127.0.0.1:2379 \
  --cacert=<trusted-ca-file> 
  --cert=<cert-file> --key=<key-file> \
  snapshot save <backup-file-location>

다음 명령어를 통해 snapshot를 디렉토리에 풀게 되고

sudo ETCDCTL_API=3 etcdctl \
--data-dir <data-dir-location> \
snapshot restore snapshotdb

etcd를 관리하는 Pod의 Yaml 파일 위치

/etc/kubernetes/manifests/etcd.yaml

 

-hostPath:
 path : ~~~~

 

를 수정하게 하게 되면 etcd Pod Static 이기에 restart를 자동적으로 한 후, 적용이 된다

 

 

블로그의 정보

PyTong

PyTong

활동하기