Skip to content

Instantly share code, notes, and snippets.

@chadmcrowell
Created October 18, 2023 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chadmcrowell/dbbbd4925f5fc4bebdb6b1a2bfff166d to your computer and use it in GitHub Desktop.
Save chadmcrowell/dbbbd4925f5fc4bebdb6b1a2bfff166d to your computer and use it in GitHub Desktop.
Dallas Kubernetes Workshop - Etcd Backup
# 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