Restore process
- Docker & Kubernetes course
- Expert
- Lesson 40/47
- 4 min
Learn to restore with Velero.
The restore process
velero restore create --from-backup restores a backup. It doesn't overwrite existing objects; it creates the missing ones. With --namespace-mappings the backup can be opened into another namespace (for example to inspect it):
$ velero restore create --from-backup gece-20261103020000
Restore request "gece-20261103020000-20261103112233" submitted successfully.
$ velero restore create inceleme --from-backup gece-20261103020000 \
--namespace-mappings magaza:magaza-inceleme
$ velero restore get
NAME BACKUP STATUS ERRORS WARNINGS
inceleme gece-20261103020000 Completed 0 2Recovering from etcd
If the whole control plane is lost, the etcd snapshot is opened into a new data directory and etcd is started with that directory. This returns the entire cluster to the moment of the snapshot:
# kube-apiserver and etcd are stopped (static pod manifests are moved)
etcdutl snapshot restore /yedek/etcd.db --data-dir /var/lib/etcd-geri
# the hostPath in the etcd manifest becomes /var/lib/etcd-geri, components are restarted
kubectl get nodesEverything created after the snapshot is lost; that's why taking frequent snapshots matters.
Practice Restore a namespace
Write three commands: list the Velero backups; create a restore named magaza-geri from the backup gece-20261103020000, taking only the magaza namespace (--include-namespaces); show the magaza-geri restore in detail (describe).
Starter code
# buraya yazSample solution
velero backup get
velero restore create magaza-geri --from-backup gece-20261103020000 --include-namespaces magaza
velero restore describe magaza-geriExpected output
NAME STATUS CREATED EXPIRES gece-20261103020000 Completed 2026-11-03 02:00:00 +0300 +03 29d Restore request "magaza-geri" submitted successfully. Name: magaza-geri Phase: Completed Total items to be restored: 38 Items restored: 38
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 When restoring a deleted namespace, what is the first step?
- Choosing a suitable, Completed backup with velero backup get Correct answer
- Deleting etcd
- Rebuilding the cluster
- Deleting all pods
Explanation: PartiallyFailed or very old backups can lead to data loss.
2 Open the backup into another namespace.
velero restore create inceleme --from-backup gece-20261103020000 ____ magaza:magaza-inceleme
velero restore create inceleme --from-backup gece-20261103020000 --namespace-mappings magaza:magaza-inceleme
Explanation: The mapping is in old:new form.
3 Match.
| Term | Meaning |
|---|---|
restore create |
Restore |
--from-backup |
Source backup |
snapshot restore |
Open etcd |
--data-dir |
New etcd directory |