'k8s etcd pod restore'에 해당되는 글 1건

1. 현재 컨텍스트 확인

$ kubectl config current-context

 

 

2. 작업 시스템(node) 접속 및 환경 확인

$ ssh <node명> # 특정 node에 ssh 접속
$ etcd --version # etcd 버전 확인
$ etcdctl version # etcdctl 버전 확인

 

3. etcd backup

공식문서: https://kubernetes.io/docs/tasks/administer-cluster/configure-upgrade-etcd/#restoring-an-etcd-cluster

$ ETCDCTL_API=3 etcdctl \
  --endpoints=https://127.0.0.1:2379 \
  --cacert=<인증서ca파일경로> \
  --cert=<클라이언트인증서파일경로> \
  --key=<클라이언트키파일경로> \
  snapshot save <백업스냅샷파일경로>

 

4. restore

공식문서: https://kubernetes.io/docs/tasks/administer-cluster/configure-upgrade-etcd/#restoring-an-etcd-cluster

$ ETCDCTL_API=3 etcdctl \
  --data-dir <복구한스냅샷이풀릴경로> \
  snapshot restore <복구할스냅샷파일경로>

 

5. etcd 파드의 data 경로 수정 적용

 

특정 네임스페이스로 동작중인 etcd pod 확인

$ kubectl get pod -n kube-system

 

 

출력 중 etcd pod 확인 가능

해당 etcd pod의 설정경로는 /etc/kubernetes/manifests/etcd.yaml 이며, spec.volumes[].name: etcd-data 의 hostPath.path 부분을 복구한 스냅샷이 풀린 경로로 수정하여 저장하면 static pod 이기 때문에 자동으로 restart 되며 적용됨.

docker ps | grep etcd 로 etcd pod 내의 컨테이너가 정상적으로 up 되었는지 확인.

 

 

 

참고 영상: https://www.youtube.com/watch?v=dv_5WCYS5P8&list=PLApuRlvrZKojqx9-wIvWP3MPtgy2B372f&index=4&ab_channel=TTABAE-LEARN

'Kubernetes' 카테고리의 다른 글

[Kubernetes] static pod 생성하기  (0) 2025.05.25
[Kubernetes] pod 생성하기  (0) 2025.05.25
블로그 이미지

망원동똑똑이

프로그래밍 지식을 자유롭게 모아두는 곳입니다.

,