-
k8s etcd 백업하기CKA 2024. 11. 24. 23:51
https://github.com/etcd-io/etcd/releases/tag/v3.5.17
Release v3.5.17 · etcd-io/etcd
Please check out CHANGELOG for a full list of changes. And make sure to read upgrade guide before upgrading etcd (there may be breaking changes). For installation guides, please check out play.etcd...
github.com
에서 맞는 etcdctl 을 다운받고, /usr/bin 에 넣어준다.
공식문서 참고
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 the data. You can find in-depth information a
kubernetes.io
명령어 예시
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>
ETCDCTL_API=3 etcdctl --endpoints 192.168.16.101:2379 \ --cert=/etc/kubernetes/pki/etcd/server.crt \ --key=/etc/kubernetes/pki/etcd/server.key \ --cacert=/etc/kubernetes/pki/etcd/ca.crt \ snapshot save etcd-backup.db
이렇게 백업 만들어주고
restore를 해준다.
export ETCDCTL_API=3 etcdctl --data-dir <data-dir-location> snapshot restore snapshot.db
etcdctl --data-dir /var/lib/etcd-backup snapshot restore etcd-backup.db
이렇게 변경한다.
vi /etc/kubernetes/manifests/etcd.yaml
이러면 끝