Take a backup of the etcd cluster and save it to /opt/etcd-backup.db
.
*template*
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>
**solve**
ETCDCTL_API=3 etcdctl --endpoints 10.26.59.12:2379 \
--cert=/etc/kubernetes/pki/etcd/server.crt \
--key=/etc/kubernetes/pki/etcd/server.key \
--cacert=/etc/kubernetes/pki/etcd/ca.crt \
snapshot save /opt/etcd-backup.db
>> 문제가 쩜 이상하다 endpoint값은 pod ip
다른 문제
First, create a snapshot of the existing etcd instance running at https://127.0.0.1:2379 ,
saving the snapshot to /data/etcd-snapshot.db.
Next, restore an existing, previous snapshot located at /data/etcd-snapshot-previous.db.
The following TLS certificates/key are supplied for connecting to the server with etcdctl:
CA certificate: /etc/Kubernetes/pki/etcd/ca.crt
Client certificate: /etc/Kubernetes/pki/etcd/server.crt
Client key: /etc/Kubernetes/pki/etcd/server.key
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 /data/etcd-snapshot.db.
cat /data/etcd-snapshot-previous.db.
***template***
ETCDCTL_API=3 etcdctl snapshot restore \
--data-dir <data-dir-location> \
snapshotdb
***solve***
ETCDCTL_API=3 etcdctl snapshot restore \
--data-dir /var/lib/etcd-new \
/data/etcd-snapshot.db.
**3) 스냅샷 이미지가 잘 적용되었는지 확인**
```bash
sudo tree /var/lib/etcd-new
4) 현재 동작중인 etcd - pod 에 etcd-new가 새로운 데이터 저장소임을 알려줘야 함.
etcd pod 는 static pod의 형태로 작동중임
static pod 는 해당 경로에 yaml파일 형태로 있음.
cd /etc/kubernetes/manifests/
ls
5) etcd pod 에 변경된 etcd 경로로 지정
hostPath 의 path 에 새로운 경로를 지정해주면 됨.
vi /etc/kubernetes/manifests/etcd.yaml
6) up 상태 확인
: Exited 된 이후 UP 이 되면 됨. (시간 소요 됨)
docker ps -a | grep etcd