KubernetesLXIX · etcd Restoreetcd restore
When to restore — the decision tree
What you'll learn
- Apply the decision tree before any restore
- Identify the failure mode that requires restore
- Validate that a snapshot is suitable before restoring
- Communicate the restoration scope to stakeholders
Prerequisites
Verified against Kubernetes 1.34.x · kubeadm 1.34.x · kubectl 1.34.x · etcd 3.6.x · CoreDNS 1.11.x · containerd 1.7.x / 2.x · 2026-08-16
A restore is destructive: it rewinds the cluster’s state to a snapshot. Done unnecessarily, it is the cause of outage. Done too late, it is the cause of unnecessary data loss. This lesson walks the decision tree that determines whether a restore is the right action, the prerequisites that make it safe, and the communication discipline that keeps stakeholders aligned.
The decision tree
flowchart LR
A[Symptom] --> Q1{Cluster still serves requests?}
Q1 -->|No| Q2{Recent healthy snapshot exists?}
Q1 -->|Yes| Q3{State is corrupted?}
Q2 -->|Yes| R[Restore from snapshot]
Q2 -->|No| NR1[Bootstrap fresh cluster]
Q3 -->|Yes| R
Q3 -->|No| NR2[Investigate; no restore]
The questions lead to one of three answers:
- Restore — the cluster is broken or the state is wrong, and a usable snapshot exists.
- Bootstrap fresh — no usable snapshot, or the snapshot is too stale.
- Investigate — the issue is not state-related; no restore is needed.
Recognising that restore is the answer
The failure modes that warrant restore:
| Failure mode | Symptom |
|---|---|
| Quorum loss | Writes time out; no leader; etcd is stuck |
| Multiple members corrupt | bbolt: page X: checksum mismatch on more than one member |
| Mass deletion | Operator script deleted many objects; state is gone |
| Compromised cluster | State was written by an attacker; restore pre-incident snapshot |
| Failed upgrade that left cluster in an inconsistent state | API server cannot reconcile; Pods fail to schedule; controllers cannot list objects |
| Disaster recovery | Site or region lost; rebuild on new infrastructure |
The unifying property: the etcd state is wrong or inaccessible, and an alternative recovery path exists (a snapshot from before the failure).
Recognising that restore is not the answer
Some failures do not need a restore:
| Failure mode | Why restore is wrong |
|---|---|
| 1 of 3 etcd members corrupt | Wipe and rejoin; quorum still holds |
| Disk full | Free disk; member rejoins |
| Slow disk / GC | Investigate; do not restore |
| Bad rollout that affected only Deployments | Roll back the Deployment; do not restore etcd |
| Single misconfigured object | Edit or delete the object; do not restore etcd |
| Bad upgrade that has been reverted | Upgrade rollback, not etcd restore |
The unifying property: the failure is recoverable without rewriting the cluster’s state.
Pre-restore validation of the snapshot
Before restoring, validate the snapshot:
# 1. The file exists and has the expected size
ls -la /backup/etcd-snapshot.db
# 2. The hash matches the upload verification
sha256sum /backup/etcd-snapshot.db
# 3. The status is non-zero
etcdutl snapshot status /backup/etcd-snapshot.db --write-out=table
+----------+----------+------------+----------------+
| HASH | REVISION | TOTAL KEY | TOTAL SIZE |
+----------+----------+------------+----------------+
| a1b2c3d4 | 41289312 | 4123 | 82419000 |
+----------+----------+------------+----------------+
A zero or unparseable hash means the snapshot is corrupt; do not restore from it. A revision older than the cluster’s known state points to a stale snapshot; reconsider.
The state capture before restore
Before the restore, capture the cluster’s current state. This is the documentation of “what we are losing”:
# Capture every API object as YAML
kubectl get all,cm,secret,sa,role,rolebinding,clusterrole,clusterrolebinding,\
crd,cr -A -o yaml > /backup/pre-restore-state.yaml
# Capture namespace list
kubectl get namespaces -o yaml > /backup/pre-restore-namespaces.yaml
# Capture events (short-retention)
kubectl get events -A > /backup/pre-restore-events.txt
# Capture lease objects (token controllers, leader election)
kubectl get leases -A -o yaml > /backup/pre-restore-leases.yaml
The pre-restore state capture is the recovery of last resort: if a critical object was lost in the restore and the recovery is straightforward, the captured state has its YAML. Some objects (leases, events) are not recoverable; document their loss.
The communication
Before the restore, communicate:
- What is being done. Restore from snapshot dated X.
- Why. Cluster has lost quorum / state is corrupt / DR.
- Expected duration. ~30-60 minutes for the restore; another 30-60 minutes for validation; 1-2 hours for workloads to reconcile.
- What will be lost. State from snapshot time to now.
- What will work after restore. Most workloads will resume from GitOps; some Secrets / ConfigMaps / nodes may need manual recovery.
- Who has approved. Two-person approval is the standard for a destructive action.
A restore is a change. It is not an automatic recovery; it is a decision. Document the decision in the incident log.
flowchart LR
A[Decision to restore] --> B[Communicate to stakeholders]
B --> C[Pre-restore state capture]
C --> D[Snapshot validation]
D --> E[Restore execution]
E --> F[Validation]
F --> G[Communication: restore complete]
The “I might need a restore” trap
An operator who is uncertain about whether to restore should:
- Capture the current state (so a future restore has a starting point).
- Snapshot the current cluster (so the latest state is preserved even if restore goes wrong).
- Document the symptoms with evidence.
- Escalate to a senior operator or incident commander.
The decision to restore is rarely reversible; the uncertainty must be resolved before pulling the trigger.
The post-decision checklist
Once the decision to restore is made, the operator has a checklist:
| Step | Time | Notes |
|---|---|---|
| 1. Pre-restore state capture | 5 min | kubectl get … -o yaml |
| 2. Pre-restore snapshot of broken cluster | 5 min | etcdctl snapshot save |
| 3. Validate chosen snapshot | 1 min | hash + status |
| 4. Stop API server | 5 min | All control-plane hosts |
| 5. Stop etcd | 5 min | All etcd hosts |
| 6. Wipe data dirs | 5 min | Per host |
| 7. Restore on each host | 10-30 min | Sequential or parallel |
| 8. Start etcd on first host | 1 min | Single-member cluster initially |
| 9. Wait for cluster formation | 5-10 min | Members discover each other |
| 10. Start API server | 5 min | All control-plane hosts |
| 11. Validate API | 5 min | kubectl get, basic checks |
| 12. Validate workloads | 30-60 min | GitOps reapply; pods running |
| 13. Validate storage and networking | 10 min | PVCs, services |
| 14. Communicate restoration complete | 1 min | Confirmed to stakeholders |
The total runtime: ~2-3 hours for a healthy restore; more if the validation surfaces issues.
When the decision tree says “no restore”
Not every symptom leads to restore. The decision tree returns “no restore” for:
- Transient etcd slowness (no data corruption).
- Single member failures (quorum preserved).
- Member caught up and rejoined.
- Bad controller logic that a workload fix can address.
- Upstream issues (DNS, network) where the etcd is healthy.
The “no restore” answer comes with its own follow-up: investigate, resolve, document.
Quiz
Knowledge check · 4 questions
Q1. Which of the following failure modes is a clear-cut restore candidate?
Q2. Capturing pre-restore state via kubectl get is an optional step that can be skipped when time is short.
Q3. The team has a 3-member cluster. Member cp-1's disk has failed. Members cp-2 and cp-3 are healthy. Walk the decision tree.
Cluster: 3-member etcd. cp-1's host has disk failure (`dmesg` shows SCSI errors). Members cp-2 and cp-3 are reachable and quorum is met. The API server can still write through cp-2 and cp-3 (assuming it's connected to both).
Q4. Why is two-person approval the standard for a destructive restore?
Passing score: 75%. Answers are checked in this browser.
Production discipline
- Apply the decision tree. Restore is one of three options (along with “investigate” and “bootstrap fresh”); choose deliberately.
- Capture pre-restore state. Always; the cost is minutes; the benefit is recovery of last resort.
- Validate the snapshot. Hash, status, freshness.
- Communicate. Destructive actions need stakeholder awareness; restore is destructive.
- Document the decision. The incident log captures who decided what, when, why.
Restore is a high-impact operation; the decision is the operator’s. The discipline of the decision tree is what makes the right answer consistent.