天天看點

k8s 快照和恢複

[email protected]:/# cat /usr/share/nginx/html/index.html 
12333333
           

生成快照

rbd snap create kube/kubernetes-dynamic[email protected]
           

修改index檔案

[email protected]:/# echo '99999' > /usr/share/nginx/html/index.html 
[email protected]:/# cat /usr/share/nginx/html/index.html 
99999
           

還原快照

[[email protected] ~]# rbd snap rollback kube/kubernetes-dynamic-pvc-e348c5fb-e152-11eb-8e9d-46b1e14d6ee6@wenruo-2021-7-12-snap
Rolling back to snapshot: 100% complete...done.
           

 還原後我們可以看到,仍然未修改回來,說明不是時時的,這裡我删除pod,讓其新挂載

[email protected]:/# cat /usr/share/nginx/html/index.html 
99999
[email protected]:/# exec attach failed: error on attach stdin: read escape sequence
command terminated with ex