Created
October 18, 2023 19:20
-
-
Save chadmcrowell/dbbbd4925f5fc4bebdb6b1a2bfff166d to your computer and use it in GitHub Desktop.
Dallas Kubernetes Workshop - Etcd Backup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# perform the commands from the following lab environment: | |
# https://studyk8s.club/cka-ectd-backup | |
# set etcdctl environment variable api to version 3 | |
export ECTDCTL_API=3 | |
# etcd help menu | |
etcdctl snapshot -h | |
# backup etcd | |
etcdctl snapshot save snapshot --cacert /etc/kubernetes/pki/etcd/ca.crt --cert /etc/kubernetes/pki/etcd/server.crt --key /etc/kubernetes/pki/etcd/server.key | |
# view the snapshot in your current directory | |
ls | |
# check the status of your snapshot | |
etcdctl snapshot status snapshot --write-out=table | |
# delete the kube-proxy daemonSet | |
k delete ds kube-proxy -n kube-system | |
# verify that the daemonSet is deleted | |
k get ds -A | |
# restore from the snapshot backup | |
etcdctl snapshot restore snapshot --data-dir /var/lib/etcd-restore | |
# update the YAML manifest for etcd | |
sed -i "79 s/lib\/etcd/lib\/etcd-restore/" /etc/kubernetes/manifests/etcd.yaml | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment