Skip to content

Instantly share code, notes, and snippets.

@texasdave2
Last active October 6, 2020 20:10
Show Gist options
  • Save texasdave2/d69a8b93099cfbb669ac79b2ee10a90f to your computer and use it in GitHub Desktop.
Save texasdave2/d69a8b93099cfbb669ac79b2ee10a90f to your computer and use it in GitHub Desktop.
backup etcd and kubeadm
mkdir -p backup
sudo cp -r /etc/kubernetes/pki ./backup
sudo docker run --rm -v $(pwd)/backup:/backup \
--network host \
-v /etc/kubernetes/pki/etcd:/etc/kubernetes/pki/etcd \
--env ETCDCTL_API=3 \
k8s.gcr.io/etcd:3.2.24 \
etcdctl --endpoints=https://127.0.0.1:2379 \
--cacert=/etc/kubernetes/pki/etcd/ca.crt \
--cert=/etc/kubernetes/pki/etcd/healthcheck-client.crt \
--key=/etc/kubernetes/pki/etcd/healthcheck-client.key \
snapshot save /backup/etcd-snapshot-latest.db
kubectl -n kube-system get cm kubeadm-config -oyaml
kubeadm config view > ./backup/kubeadm-config.yaml
### list the contents of the backup file and then tar them:
ls -lh ./backup
tar -cvzf etcd-backup.tgz ./backup
https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade-1-13/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment