84 lines
2.6 KiB
Markdown
84 lines
2.6 KiB
Markdown
# Accordion etcd restore script
|
|
[](https://git.io/typing-svg)
|
|
|
|
### 지원 환경
|
|
|
|

|
|
> accrodion v2.11.0 환경 또는 각 master node에 etcdctl을 설치한 환경
|
|
|
|
### 구조
|
|
```
|
|
.
|
|
├── etcd-restore.sh
|
|
├── etcd-restore.yml
|
|
└── roles
|
|
└── etcd-restore
|
|
├── files
|
|
├── tasks
|
|
│ ├── main.yml
|
|
│ └── redhat
|
|
│ ├── 0-etcdctl-check.yml
|
|
│ ├── 1-etcd-backup-file-copy.yml
|
|
│ ├── 2-etcd-restore.yml
|
|
│ ├── 3-etcd-restart.yml
|
|
│ ├── 4-kubelet-restart.yml
|
|
│ ├── 5-kube-apiserver-restart.yml
|
|
│ ├── 6-kube-scheduler-restart.yml
|
|
│ ├── 7-kube-controller-manager-restart.yml
|
|
│ ├── 8-delete-all-pods.yml
|
|
│ ├── 9-calico-restart.yml # 사용하지 않는 task
|
|
│ └── main.yml
|
|
├── templates
|
|
└── vars
|
|
└── main.yml
|
|
```
|
|
|
|
### 작업 순서
|
|
```
|
|
1. etcdctl 설치 여부 확인
|
|
|
|
2. etcd 백업 파일 각 서버로 복사
|
|
# /tmp 경로에 복사 #
|
|
|
|
3. 기존 etcd 백업 디렉토리 생성
|
|
# /tmp/etcd-backup-202507080403 형식으로 생성 #
|
|
|
|
4. 기존 etcd 파일 및 디렉토리 백업
|
|
|
|
5. 기존 etcd 파일 및 디렉토리 제거
|
|
# 존재할 경우 제거 #
|
|
|
|
6. etcd 복구 디렉토리 생성
|
|
# /var/lib/etcd/recover 생성 #
|
|
|
|
7. etcd 복구
|
|
# master_mode 설정에 따라 다중화 / 싱글 적용 #
|
|
|
|
8. recover -> member 디렉토리 변경
|
|
|
|
9. etcd 재기동
|
|
# 모든 etcd container의 상태가 running으로 될 경우 다음 단계 진행 #
|
|
|
|
10. kubelet 재기동
|
|
|
|
11. kube-apiserver, kube-scheduler, kube-controller-manager container 재기동
|
|
# 각각 기동이 되면 다음 단계 진행 #
|
|
|
|
12. 1분 대기
|
|
|
|
12. 모든 Pod 재기동
|
|
```
|
|
|
|
### 사용 방법
|
|
```
|
|
1. etcd 백업 파일을 accordion-installer 디렉토리로 복사
|
|
|
|
2. vi group_vars/host.yml
|
|
# host cluster 기준, member cluster는 vi group_vars/member.yml #
|
|
# 아래와 같이 수정 #
|
|
|
|
backup_dir: "/mantech/accordion-installer" # accordion-ansible container 내 경로 #
|
|
etcd_filename: "shinhan-cluster-etcd-snapshot-2025-07-08.db" # 백업 파일 이름 #
|
|
|
|
3. ./etcd-restore.sh host 또는 ./etcd-restore.sh member
|
|
``` |