Restore and disaster rehearsal
Restore into an isolated recovery environment
A restore is complete only when the recovered application meets its agreed verification criteria. Choose a separate approved disposable target, disable external delivery and scheduled side effects, and confirm the original workload cannot receive duplicate writes during rehearsal. Never overwrite the source cluster, disks or production DNS. Keep the recovered system isolated until the recovery owner accepts evidence.
Source (unchanged) → protected recovery artifacts → isolated targetNo live traffic, payment processing or production writesOrder recovery by dependency
Inventory the target Kubernetes and add-on versions, CRDs, controllers, storage and network capabilities, image availability and identity prerequisites. Bootstrap the required platform services and access controls first. Install compatible schemas and controllers before custom objects that require them. Recover storage and application configuration, reconstruct secrets through approved mechanisms, then start workloads in a safe dependency order. A restore tool may handle parts of this order, but application dependencies still require a runbook. Do not copy stale UIDs, resourceVersions or cluster-assigned addresses as portable identity.
Target checks → CRDs/controllers → identity/configuration + storage→ database restore + integrity checks → application → smoke tests→ approved traffic cutover (outside this lab)Velero and CSI recovery lanes
Velero is an optional backup and restore tool for Kubernetes resources and supported data protection workflows. Its filtering rules, storage plugins, permissions and installed API versions determine coverage. CSI VolumeSnapshot resources require compatible snapshot infrastructure and a driver that supports the feature. Moving CSI snapshot data to an independent backup repository can help with storage failure domains; verify destination accessibility, driver support, restore size and storage-class mapping. Velero v1.18 is the documentation lane here, not a tested compatibility pin. A completed restore object does not establish that business data is correct.
Illustrative inventory only:Tool: Velero (v1.18 documentation)Object scope: bookstore namespace + required cluster dependenciesData: separate protected backup repositoryTarget: compatible CSI driver and mapped StorageClassVerify actual data, not just running Pods
In the local exercise, orders.csv is an immutable synthetic backup. Copy it into a fresh temporary directory and calculate SHA-256 for both source and restored bytes. Compare against the recorded digest; then parse restored records and verify unique IDs, item references and total quantity. A matching digest confirms bytes match the expected artifact, not that it was authentic, fresh or application-consistent. An independent trusted digest and business checks are essential; the lab digest is only a local fixture.
Expected rows: 3Expected distinct order IDs: 3Expected total quantity: 6Expected referenced items: book-a, book-bActual checksum and business checks must both passMeasure recovery and define stop conditions
Record the latest recoverable application point, disruption time, verified business recovery time, missing records, warnings and operator actions. Stop if the target is not isolated, required keys are unavailable, schemas are incompatible, the checksum or transaction invariant fails, or the restore exceeds a target. Escalate before considering a real cutover. A successful local file copy is not evidence that a Kubernetes volume was recovered. Retain the report, update the runbook and repeat after major platform or application changes.
Recovery acceptance = isolated target + compatible dependencies + data integrity + business smoke tests + approved RPO/RTOAny failed prerequisite: stop and investigatePractice: rehearse and explain
Run python3 validate_offline.py from lab-fixtures/disaster-recovery. It requires only the Python standard library and writes into a temporary directory, never to a cluster. Inspect the positive restore and the deliberately altered and logically invalid records. Review rehearsal-cases.json and propose a recovery sequence for a missing controller or unavailable key. Explain why successful local checks cannot certify Velero, a CSI snapshot or a production recovery time. Next chapter: CustomResourceDefinitions and API extensions.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Restore and disaster rehearsal — knowledge check
Plan an isolated Kubernetes recovery rehearsal, validate data integrity, and evaluate recovery acceptance criteria.
Where should a rehearsal first restore protected artifacts?
Which dependency should normally exist before restoring custom objects that require it?
What does a matching SHA-256 digest establish in this lab?
A CSI restore reports completion but the required decryption key is unavailable. What should the operator do?
When is the rehearsal accepted by the example gate?