1. 현재 컨텍스트 확인
$ kubectl config current-context
2. 작업 시스템(node) 접속 및 환경 확인
$ ssh <node명> # 특정 node에 ssh 접속
$ etcd --version # etcd 버전 확인
$ etcdctl version # etcdctl 버전 확인
3. etcd backup
$ ETCDCTL_API=3 etcdctl \
--endpoints=https://127.0.0.1:2379 \
--cacert=<인증서ca파일경로> \
--cert=<클라이언트인증서파일경로> \
--key=<클라이언트키파일경로> \
snapshot save <백업스냅샷파일경로>
4. restore
$ 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 되었는지 확인.
'Kubernetes' 카테고리의 다른 글
[Kubernetes] static pod 생성하기 (0) | 2025.05.25 |
---|---|
[Kubernetes] pod 생성하기 (0) | 2025.05.25 |