CKA 模拟真题 Killer.sh | Question 25 | Etcd Snapshot Save and Restore
Task weight: 8%
Use context: kubectl config use-context k8s-c3-CCC
Make a backup of etcd running on cluster3-controlplane1 and save it on the controlplane node at /tmp/etcd-backup.db .
Then create a Pod of your kind in the cluster.
Finally restore the backup, confirm the cluster is still working and that the created Pod is no longer with us.
译文
备份运行在 cluster3-controlplane1 上的 etcd,并将其保存在 controlplane 节点上的 /tmp/etcd-backup.db 中。
然后在集群中创建一个 Pod。
最后还原备份,确认集群仍在运行,且创建的 Pod 已不复存在。
解答
kubectl config use-context k8s-c3-CCC |
远程连接cluster3-controlplane1后 检查etcd配置文件,查找证书文件等
ssh cluster3-controlplane1 |
备份etcd
root@cluster3-controlplane1:~# ETCDCTL_API=3 etcdctl snapshot save /tmp/etcd-backup.db \ |
恢复etcd
创建pod
root@cluster3-controlplane1:~# kubectl run test --image=nginx |
停止所有控制面板组件
root@cluster3-controlplane1:~# cd /etc/kubernetes/manifests/ |
恢复etcd
root@cluster3-controlplane1:~# ETCDCTL_API=3 etcdctl snapshot restore /tmp/etcd-backup.db \ |
编辑etcd文件
root@cluster3-controlplane1:~# vim /etc/kubernetes/etcd.yaml |
etcd.yaml
# /etc/kubernetes/etcd.yaml |
恢复yaml文件,并检查容器和pod
root@cluster3-controlplane1:/etc/kubernetes/manifests# mv ../*.yaml . |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Hao DevSecOps!
评论



