Disaster Recovery from etcd Snapshots in Kubernetes

Disaster Recovery from etcd Snapshots in Kubernetes

Every Kubernetes cluster keeps its entire memory in one small database called etcd. If that memory is lost or damaged, the cluster forgets what it was running. This guide explains how snapshots protect that memory, how to take them properly, and how to bring a cluster back to life from one when things go badly wrong.

Imagine a large library where the only complete catalog of every book, every borrower and every shelf location is kept in a single notebook in the librarian’s office. The books themselves are safe on the shelves, but if the notebook is destroyed by a flood, nobody can say which book belongs where, who borrowed what, or which rules apply. A wise library therefore photographs that notebook every hour and keeps the photographs in a different building. Kubernetes has exactly such a notebook, and etcd snapshots are the photographs.

1Why etcd Is the Heart of the Cluster

Before we talk about rescuing something, we must understand what it is and why losing it hurts so much.

Kubernetes is a system that runs applications across many computers. To do that job, it needs to remember a great deal: which applications should run, how many copies of each, which settings and secrets they use, which network rules apply, and which people may do what. All of this memory lives in a database called etcd. The word is pronounced “et-see-dee”. It is a distributed key-value store, which means it keeps pairs of names and values, and it keeps copies of them on several machines at the same time.

Every other part of Kubernetes is built so that it can be thrown away and rebuilt. The API server keeps nothing of its own. The scheduler and controllers keep only short-lived notes. The nodes can be replaced. But if etcd is lost and there is no backup, all of the desired state of the cluster is gone. The containers might still be running on the machines for a while, but nothing knows what they are for or how to manage them.

Simple Analogy

Think of a ship’s logbook. The crew, the engine and the sails can all be replaced in port, but without the logbook nobody remembers the route, the cargo or the promises made to passengers. etcd is the logbook of a Kubernetes cluster, and a snapshot is a careful copy of that logbook kept safely on land.

Term 1

etcd

The database where Kubernetes stores its entire desired state. Only the API server is meant to talk to it directly.

Term 2

Snapshot

A single file that holds a copy of everything in etcd at one moment in time.

Term 3

Restore

The process of building a fresh etcd from a snapshot file so the cluster can remember its old state again.

Term 4

Disaster recovery

The planned set of steps for bringing a system back after a serious failure, not just a small hiccup.

i
Remember

Backing up the machines that run your applications is not the same as backing up the cluster’s memory. If you only have one backup, make it an etcd snapshot, because almost everything else can be rebuilt from it or from your source control.

2What Is Actually Stored Inside etcd

Knowing what is in the database tells you exactly what a snapshot protects.

etcd holds every object that you can create through the Kubernetes API. This includes Deployments, StatefulSets, DaemonSets, Pods, Services, ConfigMaps, Secrets, Namespaces, roles and role bindings, custom resources, storage claims and much more. Each object is stored under a key that looks like a file path, and the value is the object itself, written in a compact format.

It also stores things that you rarely think about but that are very important. Events, leases used for leader election, the list of nodes and their reported status, and the information about which version of each resource is stored all live in etcd. Because the cluster uses it for every decision, etcd is read and written constantly.

Kind of dataExamplesHow painful is losing it
Workload definitionsDeployments, StatefulSets, Jobs, PodsApplications stop being managed and cannot be recreated automatically
ConfigurationConfigMaps, Services, Ingresses, network policiesApplications lose their settings and routing
SecretsPasswords, tokens, certificatesApplications cannot authenticate to their dependencies
Access controlRoles, bindings, service accountsPeople and programs lose their permissions or gain wrong ones
Storage linksPersistentVolumes and claimsDisks may still exist but the cluster forgets which application owns which
Custom resourcesDatabase clusters, certificates, policy objectsOperators lose the objects they manage
Cluster bookkeepingNodes, leases, eventsMostly rebuilt automatically, but gaps can confuse controllers
!
Important

Secrets in etcd are only encoded, not protected, unless encryption at rest has been switched on. A stolen snapshot can therefore reveal every password in the cluster. Treat every snapshot file as highly sensitive.

3What a “Disaster” Really Looks Like

Not every failure is the same size, and the right response depends on which kind you are facing.

When people say disaster, they often imagine a whole data center burning down. In practice, the situations that call for a snapshot are many and varied. Some are caused by hardware, some by software, and many by people. A good plan names these situations in advance so that nobody has to guess in the middle of the night.

Loss of quorum

In a three-member etcd cluster, two machines fail at once. The remaining member cannot make decisions alone, so the cluster stops accepting changes. This is the classic case where a snapshot restore is needed.

Loss of all control plane machines

A whole site loses power, or a cloud zone goes down, or an automation mistake deletes all control plane machines. The data disks may be gone too.

Data corruption

A disk fault or a software bug damages the database files. The cluster may refuse to start, or may give strange answers.

Human error

Someone deletes a namespace, a custom resource definition, or a large set of objects by mistake. The cluster is healthy but the data is gone, and all members have faithfully copied the deletion.

Bad upgrade or bad change

A control plane upgrade, a storage migration or a faulty operator changes data in a damaging way, and rolling back the software does not undo the data change.

Malicious activity

An attacker or ransomware encrypts or deletes data. A backup that the attacker cannot reach or alter becomes the last line of defense.

Simple Analogy

Having three copies of a document on three computers protects you if one computer breaks. It does not protect you if you accidentally delete the text and all three computers dutifully save the empty file. Replication protects against machine failure, while backups protect against everything else.

“Replication keeps you running when a machine dies. Backups bring you back when the data itself is wrong.”

4RPO and RTO: Setting Your Goals First

Two simple numbers decide how often you back up and how much you invest in practice.

Before choosing tools, a team must decide how much loss it can accept and how much waiting it can bear. Two short terms describe this.

Goal 1

RPO: Recovery Point Objective

How much recent data you can afford to lose, measured in time. If your RPO is one hour, you need a good backup at least every hour.

Goal 2

RTO: Recovery Time Objective

How long the cluster may stay unusable before it must be working again. This decides how well rehearsed and automated your recovery must be.

Simple Analogy

When you write an important essay, RPO is how much typing you are willing to redo if the computer crashes, perhaps the last ten minutes if autosave runs every ten minutes. RTO is how long you can wait to get back to your desk and keep working after the crash.

Turning goals into decisions

A short RPO means frequent snapshots, and possibly additional tools that capture changes between snapshots. A short RTO means automation, tested runbooks, spare machines ready to use, and people who have practiced the steps. A relaxed RPO and RTO mean lower cost, but you must make sure the whole organization agrees to the consequences.

EnvironmentTypical RPOTypical RTOWhat it implies
Development and testOne dayMany hoursA daily snapshot is probably enough and rebuilding from source control is acceptable
Internal toolsSeveral hoursA few hoursSnapshots every hour or two with a written runbook
Customer-facing productionMinutes to one hourUnder an hourFrequent snapshots, offsite copies, rehearsed recovery and often a standby plan
!
Common Mistake

Setting goals by feeling instead of by agreement. Write the RPO and RTO down, get the business owner to approve them, and check that your backup schedule and practice schedule actually match.

5Raft and Quorum in Plain Words

To know when a snapshot restore is truly needed, you must know how etcd decides things.

etcd usually runs as a group of members, often three or five. They agree on every change using a method called Raft. In Raft, one member is the leader and the others are followers. All changes go through the leader, which sends them to the followers. A change counts as saved only when a majority of members have written it down. That majority is called the quorum.

This design means that the cluster keeps working as long as a majority is alive. With three members, the majority is two, so one failure is tolerated. With five members, the majority is three, so two failures are tolerated. Adding an even number does not help: four members still need three to agree, so four tolerate only one failure, just like three.

MembersMajority neededFailures tolerated
110
220
321
431
532
743
flowchart LR
  C["Client write"] --> L["Leader"]
  L --> F1["Follower 1"]
  L --> F2["Follower 2"]
  F1 -->|"Saved"| L
  F2 -->|"Saved"| L
  L --> OK["Majority confirmed: write is final"]
        
FIG 1 — A write counts only after a majority of members have saved it
Simple Analogy

A town council of three needs two votes to pass any rule. If one councillor is sick, the other two can still decide. If two are away, the one who remains cannot pass anything, because a single voice is not a majority, and that protects the town from a lone person making unchecked decisions.

i
Why this matters for recovery

When a majority is lost and cannot be brought back, the remaining members will not accept changes. That is when a snapshot restore, or a special forced restart, becomes the way forward.

6Not Every Failure Needs a Snapshot

Using a snapshot when it is not needed throws away recent data, so choose the lightest fix that works.

A snapshot restore takes the cluster back in time to the moment the snapshot was taken. Everything that happened afterwards is lost. That is a heavy price, so it should be a last choice. In many situations, a lighter fix is better.

1

One member fails, majority is alive

The cluster keeps working. Remove the broken member from the group, prepare a fresh machine, and add a new member. It copies the data from the others automatically. No snapshot is needed.

2

A member is only slow or restarted

Check disks, network and memory first. A member that has fallen behind will usually catch up by itself once the problem is fixed.

3

Majority lost but disks are intact

If the machines can be repaired or reattached with their data, bring them back and quorum returns without any restore.

4

Only one healthy copy remains and others cannot return

You can sometimes restart that single member as a new one-member cluster using a special flag, then grow it again. This keeps the latest data but must be done carefully.

5

No healthy data, or the data itself is wrong

This is when a snapshot restore is the right tool. You accept going back to the snapshot time in return for a working, consistent cluster.

!
Common Mistake

Restoring from a snapshot at the first sign of trouble. Always check the health and member list of the existing cluster first. A restore that was not needed turns a small incident into a large data loss.

7What a Snapshot Is and How It Works

A snapshot is a simple idea with a few important details.

An etcd snapshot is a single file that contains the full contents of the etcd database at a particular moment. The file is taken from one member through the normal etcd client connection. etcd keeps a version number for every change, called a revision, and a snapshot captures everything up to a certain revision. Because it is a point-in-time copy, it gives a consistent picture of the whole cluster state, with no half-written objects.

The tool for taking one is the command line client etcdctl, with a snapshot save command. The tool for inspecting and restoring one is etcdutl. In older releases, these functions were part of etcdctl, and you may see that in older guides. In newer releases, the offline operations on files were moved to etcdutl.

sequenceDiagram
  participant Op as Operator or Job
  participant E as etcd member
  participant S as Snapshot file
  participant R as Remote storage
  Op->>E: Request snapshot over TLS
  E-->>Op: Stream database contents at one revision
  Op->>S: Write file to disk
  Op->>S: Verify file status and hash
  Op->>R: Copy file to safe offsite storage
        
FIG 2 — The life of one snapshot from request to safe storage

Why snapshots are consistent

etcd uses a storage engine that keeps older versions of data for a short time. When a snapshot is requested, etcd reads from a stable view of the database, so the cluster can keep running and accepting changes while the copy is made. The cluster does not need to be stopped. The only cost is a little extra disk and network use while the file is streamed.

Simple Analogy

Taking a snapshot is like taking a photograph of a busy street. People keep moving, but the picture shows exactly where everyone was at the instant the shutter clicked, with nobody half in and half out of the frame.

i
Good Practice

Copying the raw database files from the data folder while etcd is running is not a safe backup method. The files may be caught in the middle of a write. Use the snapshot feature instead.

8What a Snapshot Does Not Contain

Many recovery plans fail because people expect a snapshot to hold more than it does.

A snapshot holds the state of the Kubernetes objects. It does not hold everything needed to rebuild a cluster from nothing. A complete disaster recovery plan must also protect the missing pieces.

Not in the snapshotWhy it mattersHow to protect it
Control plane certificates and keysThe API server and etcd need them to trust each other. The service account signing key is also kept here.Back up the certificate folder separately and keep it secure
Encryption configuration and keysWithout the key, encrypted Secrets in a restored cluster cannot be readStore the key in a safe place that is separate from the snapshot
Application data on disksDatabases and file stores keep their data on volumes, not in etcdUse volume snapshots, database backups or storage replication
Container imagesNodes pull images from registries after the restoreMake sure registries are themselves backed up and reachable
Node machines and operating systemsThe snapshot does not recreate computersUse infrastructure as code to rebuild machines
External resourcesCloud load balancers, DNS entries and disks live outside the clusterDocument them and keep their definitions in code
Control plane configuration filesAPI server flags and static Pod definitions are files on the machinesKeep copies in source control or in your backup set
Simple Analogy

A photograph of the library’s catalog tells you where every book should be, but it does not contain the books, the keys to the building or the staff. To reopen the library you need the catalog, the keys, the books and the people, and each needs its own plan.

!
Important

A restored cluster whose application volumes are lost will happily recreate Pods that find empty disks. The cluster looks healthy while the data is gone. Always plan data protection for volumes together with etcd backups.

9Taking a Snapshot: The Steps and Prerequisites

The process is short, but each part needs to be right for the file to be useful when you most need it.

Taking a snapshot needs only a few ingredients. You need the etcd client tool, the address of a healthy member, and the credentials to talk to it. etcd normally requires mutual TLS, so you provide the certificate authority file, a client certificate and a client key. On a cluster built with kubeadm, these files are usually under the control plane’s certificate folder, in a subfolder for etcd.

1

Choose a healthy member

Check the health and member list first. Take the snapshot from a member that is up to date, and talk to one member address at a time so you know exactly which copy you are reading.

2

Connect with proper credentials

Provide the endpoint, the certificate authority, the client certificate and the client key so the secure connection succeeds.

3

Save the snapshot to a file

Use the snapshot save feature and give the file a name that includes the date, time and cluster name so that you can tell backups apart later.

4

Check the file

Read back its status. It reports a hash, the revision, the number of keys and the size. A file that cannot be read back is not a backup.

5

Move it off the machine

Copy it to storage that lives somewhere else, and only then count it as a real backup.

i
Good Practice

Take snapshots from a follower rather than the leader when you can. Streaming a large database puts some extra load on the member, and the leader already has the most work to do.

!
Common Mistake

Asking for a snapshot from a load balancer address that spreads requests over several members. Always connect to a specific member, otherwise you cannot be sure which member produced the file.

10Verifying That a Snapshot Is Good

A backup that has never been checked is only a hope.

Verification happens in layers, and each layer catches a different kind of problem. The cheapest layer is checking the file’s status. The status report shows the hash of the content, the revision at which it was taken, the total number of keys and the file size. A file that is empty, too small, or that fails to read has clearly gone wrong.

The next layer is comparing numbers over time. If your snapshots are normally around a certain size and one suddenly shrinks to a tiny fraction of that, something is wrong, perhaps with the cluster itself. If the key count falls sharply, someone may have deleted a lot of objects, and you will want to know before older backups expire.

The strongest layer is a real test: restore the file into a temporary, isolated etcd on a scratch machine, and then read a few known objects back. This proves that the file can actually be restored, which is the only thing that truly matters.

Layer 1

Status check

Read the hash, revision, key count and size from the file right after it is made.

Layer 2

Trend check

Compare size and key count against earlier snapshots to spot sudden drops or jumps.

Layer 3

Transfer check

After copying to remote storage, compare checksums so you know the stored copy matches the original.

Layer 4

Restore test

Periodically restore into a scratch environment and look at real objects. This is the true proof.

Simple Analogy

A fire extinguisher that has never been tested may be empty. A backup that has never been restored may be empty too. The only way to learn the truth is to try using it while the situation is calm.

11Automating Backups: Schedules and Retention

People forget and machines do not, so snapshots should be taken by a scheduled job rather than by hand.

A manual backup done once a month is very unlikely to satisfy any serious RPO. The job should be automated and should run on a regular schedule that fits your goals. There are several common ways to run it. A Kubernetes CronJob can be pinned to a control plane node, given access to the etcd certificates, and set to run on a schedule. Alternatively, a timer on the control plane operating system can run a script. Some teams use backup operators or tools provided by their distribution.

Advantages of a CronJob

  • Lives inside the cluster and is easy to see and manage
  • Failures show up as failed Jobs with logs
  • Configuration is stored as ordinary objects

Disadvantages / Trade-offs

  • If the cluster is down, the job that would back it up is down too
  • Needs access to sensitive certificates
  • Must be pinned to control plane nodes to reach the files

How often and how long to keep

Frequency should follow your RPO. Many teams take a snapshot every thirty minutes to one hour for production. Retention should follow a layered approach: keep many recent snapshots, fewer older ones and a small number of very old ones. The recent ones help when you need to undo a mistake from this morning. The older ones help when a slow corruption went unnoticed for days.

Age of backupExample schedule keptWhy
Last 24 hoursEvery hourFine-grained recovery from recent mistakes
Last weekOne or two per dayRecovery from problems noticed the next day
Last monthOne per weekRecovery from slow or unnoticed problems
Last yearOne per monthAudit and compliance needs
!
Common Mistake

A backup job that fails silently for weeks. Always alert when no new successful snapshot has appeared within the expected time. The absence of a backup is the most dangerous thing a backup system can hide.

12Storing Backups Safely

A snapshot kept next to the thing it protects is a snapshot that will be lost in the same disaster.

The place where you store snapshots matters as much as the snapshots themselves. A snapshot that sits on the same disk as etcd will vanish when that disk fails. A snapshot on the same machine will vanish when the machine is lost. A snapshot in the same cloud account may be reachable by an attacker who has already taken over that account.

Rule 1

Keep copies offsite

Store at least one copy in a different location, such as another zone, region or provider, so one event cannot destroy both.

Rule 2

Make them hard to delete

Use storage features that block deletion or overwriting for a period, so that a mistake or an attacker cannot remove all copies quickly.

Rule 3

Encrypt them

Encrypt files at rest and in transit, because a snapshot may contain every secret in the cluster.

Rule 4

Limit who can read them

Give read access to very few people and log all access. Treat the bucket like a vault.

Rule 5

Separate the credentials

The cluster’s own credentials should be able to add new backups but not delete old ones.

Rule 6

Know where they are

Write down the location and the way to reach it in a place that survives a cluster outage, not only inside the cluster.

Simple Analogy

Keeping a spare house key under the doormat of the same house is useful against losing your keys, but it does nothing if the house burns down, and it helps a burglar. A spare key with a trusted neighbor in a different street, locked in a box, works far better.

i
Good Practice

Apply the idea of three copies, on two kinds of storage, with one copy offsite. It is an old and reliable rule that suits Kubernetes backups very well.

13Encryption at Rest and the Key You Must Not Lose

A snapshot can be perfect and still be unusable if one small piece of configuration is missing.

Kubernetes can encrypt chosen resources, usually Secrets, before the API server writes them into etcd. This is called encryption at rest. It is a very good practice, because it means a stolen snapshot or a stolen disk does not directly reveal passwords and tokens. But it creates a dependency that is easy to forget. The snapshot contains encrypted data. The keys that unlock it are not inside etcd. They live in the API server’s encryption configuration, or in an external key management service.

If the cluster is rebuilt from a snapshot but the key is gone, the API server will not be able to read the encrypted Secrets. Applications that depend on them will fail, and no amount of restoring will fix that. The key and the snapshot are like a lock and its key: each is useless without the other.

Simple Analogy

Imagine locking your valuables in a safe and then storing the safe in a warehouse for protection. If you lose the only key, the warehouse is perfectly safe and also completely useless. The encryption key is that key, and the snapshot is the safe.

Case 1

Keys in a local configuration file

The file lives on the control plane machines. Back it up securely and separately from the snapshots, and keep it out of the same storage location.

Case 2

Keys in an external key service

The cluster asks a managed key service to unwrap its data keys. Make sure the key service itself is protected and that your restored cluster will be allowed to reach it.

Case 3

Old keys after rotation

When keys are rotated, older snapshots may still need the older key. Keep retired keys as long as you keep the snapshots that need them.

!
Common Mistake

Storing the encryption key in the same bucket as the snapshots. Anyone who can read the bucket then holds both the lock and the key, and the protection is gone.

14Quorum Loss: The Classic Disaster

When most of the members are gone, the survivors will not make decisions, and that is by design.

Suppose a cluster has three etcd members and two of them are lost. The survivor knows it is alone and it knows that a majority is two. It will refuse to accept writes because it cannot be sure that the other two are not alive, working and accepting different writes on the other side of a broken network. This refusal is what protects the data from split-brain, where two halves of the cluster make conflicting decisions.

To the outside world, the symptoms look dramatic. The API server answers slowly, or times out, or returns errors about the storage backend. Existing Pods keep running on the nodes, because the kubelets do not need the control plane to keep containers alive. But no new Pods can be scheduled, no changes can be applied, and the cluster cannot heal itself.

flowchart TD
  S["Cluster stops accepting changes"] --> Q1{"Can failed members return with their data?"}
  Q1 -->|Yes| A["Repair machines and restart them. Quorum returns."]
  Q1 -->|No| Q2{"Is at least one healthy member with recent data left?"}
  Q2 -->|Yes| B["Consider restarting it as a new single member, then add others"]
  Q2 -->|No| C["Restore every member from the latest good snapshot"]
  B --> D["Verify and grow the cluster again"]
  C --> D
        
FIG 3 — Choosing a path after quorum is lost

The two real options when members are gone for good

If one healthy copy remains and it holds recent data, there is a special start option that makes a member forget its old peers and start a fresh one-member cluster from its own data. This keeps the most recent state and is often the fastest path. It should be used with care, and only when you are certain that the other members will not return, because bringing back an old member later could cause confusion. If no healthy copy remains, the snapshot is the only way forward.

i
Good Practice

Before any dramatic step, take a copy of whatever data is left on the survivors. Even a damaged data folder may help later, and copying it costs almost nothing compared with losing it.

15The Big Picture of a Restore

Before diving into the details, here is the whole journey in one view.

Restoring a cluster from a snapshot is a sequence of careful stages. It is not a single command. The reason is that etcd, the API server and the other components all hold assumptions about each other, and those assumptions must be reset in the right order.

1

Decide and gather

Confirm that a restore is truly needed. Find the right snapshot, the certificates, the encryption key and the configuration files.

2

Stop the writers

Stop every API server so nothing can talk to etcd while you work. Stop the old etcd members as well.

3

Restore the data

On each etcd member, build a new data folder from the same snapshot file, giving each member its identity and the list of peers.

4

Start etcd

Point each member at its new data folder and start them. Check that they find each other and elect a leader.

5

Start the control plane

Bring back the API servers, then restart the controller manager, the scheduler and the kubelets so they discard stale information.

6

Verify and reconcile

Check health, nodes, workloads, storage and secrets. Deal with anything that changed after the snapshot time.

“A restore is a controlled trip back in time, and the whole cluster must agree to travel together.”
!
Common Mistake

Restoring only one member and starting it alongside the old, un-restored members. The members will have different histories, and they will either refuse to cooperate or, worse, mix up their data.

16Preparing for the Restore

Time spent preparing here saves hours later, and prevents making things worse.

Gather what you need

Place everything you need on the control plane machines before you start. This includes the snapshot file, the certificates for etcd, the encryption configuration, the manifests or service definitions for etcd and the API server, and the tools, meaning a recent enough etcd utility that matches your etcd version. Check the snapshot file’s status and checksum again, so you know the file is intact and was not damaged during transfer.

Freeze the cluster

On a cluster built with kubeadm, the control plane components run as static Pods, defined by files in a folder on each control plane machine. The kubelet watches that folder. Moving the API server and etcd definition files out of the folder makes the kubelet stop those Pods. This is the clean way to stop them. Make sure nobody and nothing else, such as automation or a deployment pipeline, is trying to change the cluster while you work.

Check 1

Snapshot is chosen and verified

You know its time, its hash and the reason it is the right one to use.

Check 2

Keys and certificates are present

The etcd certificates, the cluster certificates and the encryption key are available on each machine.

Check 3

Tool versions match

The etcd tool you use should match the version of etcd you are running, to avoid format surprises.

Check 4

Old data is kept safe

Rename and keep the old data folder rather than deleting it, so you can go back if something goes wrong.

Check 5

People are informed

Teams that deploy to the cluster know it is frozen, and one person leads the restore while another keeps notes.

Check 6

Writers are stopped

Every API server is stopped, and automation tools that write to the cluster are paused.

i
Good Practice

Assign roles during a recovery: one person types the commands, another reads the steps aloud and checks each one, and a third records times and results. Mistakes are far more common when one tired person does everything.

17Restoring the Snapshot into a New Data Folder

The restore does not repair the old database. It builds a brand-new one from the snapshot.

The restore operation reads the snapshot file and writes a fresh data folder. The folder must not already exist, so the tool never overwrites old data by accident. During the restore, the tool checks the file’s integrity hash, unless you tell it to skip that check, which you only do when the snapshot was copied directly from a data folder instead of being taken by the snapshot feature.

A new identity for the cluster

The most important thing about a restore is that it gives the cluster a new identity. The restored data is stamped with a fresh cluster identifier and new member identifiers. Because of this, old members that were not restored cannot accidentally rejoin and bring old history with them. They will be treated as strangers.

For this to work, each member needs to be told, at restore time, three things: its own name, its own peer address, and the full list of members with their peer addresses. A shared token that identifies this new cluster is also supplied. Every member must receive the same list and the same token, and each must have its own name and address.

Information given at restorePurposeRule
Snapshot fileThe data to restoreThe same file for every member
New data folderWhere the restored database is writtenMust not exist already, and must be on a fast, reliable disk
Member nameIdentifies this member within the groupUnique for each member
Peer address of this memberHow other members reach itUnique for each member, matches the certificates
List of all members and peersDefines the new groupIdentical on every member
Cluster tokenNames the new clusterIdentical on every member, and different from the old one
Simple Analogy

When a club is re-founded from old records, it receives a new membership number and a new charter, so that the old, scattered club cards from before the collapse do not cause confusion. Everyone who joins the new club receives the same copy of the member list.

i
Newer tool options

Some newer versions of the restore tool can move the database’s revision counter forward after a restore. This helps programs that cache data from the API server, because they never see the revision numbers go backwards. Check the documentation for the version you run.

18Restoring a Multi-Member Cluster

With several members, the same steps are repeated on each machine, and consistency is everything.

In a cluster with three or five members, every member is restored from the same snapshot file, each into its own new data folder, with its own name and address but with the same list of members and the same cluster token. When all are restored, you start them together. They find each other using the list you gave them, elect a leader, and form a working cluster that starts from the snapshot’s data.

flowchart LR
  F["Same snapshot file"] --> M1["Member 1: new data folder"]
  F --> M2["Member 2: new data folder"]
  F --> M3["Member 3: new data folder"]
  M1 --> C["New cluster with new identity"]
  M2 --> C
  M3 --> C
        
FIG 4 — Every member is rebuilt from the same snapshot with the same group definition

An alternative: restore one, then grow

Some teams prefer a slower but simpler approach. They restore a single member as a one-member cluster, start it, confirm that the data looks right, and then add the other members one by one as fresh, empty members that copy the data from the first. This reduces the chance of a configuration mistake in the member list, and it lets you test the restored data before scaling out. It takes longer, which matters if your recovery time goal is tight.

Restoring all members at once

  • Faster to reach full redundancy
  • All members begin with identical data
  • Works well when steps are scripted and rehearsed

Restoring one and growing

  • Lets you inspect the data before adding more members
  • Lower risk of a typing mistake in the member list
  • Slower, and you run with no redundancy for a while
!
Common Mistake

Mixing certificates and addresses. Each member’s certificate must match the address you give for it. A mismatch makes members reject each other, and the error messages are often confusing.

19Bringing the Control Plane Back (kubeadm Clusters)

On a typical kubeadm cluster, etcd and the API server are static Pods, and the details of that matter.

On a kubeadm cluster with the usual layout, the definition of the etcd Pod includes a mounted folder where etcd keeps its data. After a restore into a new folder, you must edit that definition so that it points to the new folder. The kubelet notices that the file changed and recreates the etcd Pod using the restored data. You also need to make sure the member name, the peer address, and the member list in the definition match what you used during the restore, because etcd reads them at start.

1

Stop the Pods

Move the API server and etcd definition files out of the manifests folder. Wait until the containers are really gone.

2

Restore to a new folder

Run the restore on each member. Keep the old data folder aside under a new name instead of deleting it.

3

Edit the etcd definition

Change the data folder to the restored one and check the cluster settings, such as the member name and the cluster token.

4

Return the etcd definition

Put the etcd file back in the manifests folder. The kubelet starts etcd. Check that members connect and a leader is elected.

5

Return the API server definition

Once etcd is healthy, put the API server file back. It reconnects to etcd and begins to serve the restored data.

6

Restart the other components

Restart the controller manager, the scheduler and the kubelets so that they drop anything they had remembered from before the restore.

i
Good Practice

Keep a copy of the original manifests and of the edited ones side by side. If a typo causes a startup problem, a quick comparison finds it faster than staring at a single file.

Other kinds of clusters differ in the details. Clusters where etcd runs as a system service use the service definition rather than a static Pod file. Clusters using external etcd have a separate set of machines for the database, so the restore happens there, and the API servers are then pointed at it. The ideas are the same in each case: stop the writers, restore, start etcd, then start the API servers.

20After the Restore: Living with Time Travel

The cluster now believes it is the moment of the snapshot, but the world has moved on.

The restored cluster remembers the past correctly, but the real world did not rewind. Containers kept running on nodes. Cloud disks were created and deleted. Customers kept using your applications. The difference between what etcd now believes and what is really true is the main challenge after a restore.

Effect 1

Newer objects are gone

Anything created after the snapshot, such as new Deployments, Secrets or ConfigMaps, is missing. Teams must re-apply recent changes from source control.

Effect 2

Deleted objects return

Anything deleted after the snapshot reappears, including old versions of applications or configuration that someone had removed on purpose.

Effect 3

Pods that no longer exist are stopped

The kubelet compares its running containers with what the API server says should run. Containers for Pods that the restored cluster knows nothing about are stopped.

Effect 4

Storage can be out of step

Volumes created after the snapshot exist in the storage system but not in the cluster. Volumes the cluster remembers may have been removed from storage.

Effect 5

Clients may be confused

Programs that cached data or remembered a position in the change stream may see numbers that go backwards. Restarting them clears the confusion.

Effect 6

Nodes re-register

Nodes that joined after the snapshot usually register again by themselves if their certificates are still valid. Nodes that left may linger in the list until removed.

Simple Analogy

Imagine a hotel that restores its booking system from last night’s copy. It forgets this morning’s check-ins, and it re-lists guests who already left. The front desk then walks the corridors and compares the rooms with the list, fixing each difference by hand. After a restore, controllers and operators do this walk for the cluster.

!
Important

Automated controllers act on what they see, so a restored cluster may quickly start recreating Pods and attaching volumes. Check the state of critical stateful applications quickly, and consider pausing risky automation until you have looked around.

21The Post-Restore Validation Checklist

Work through the same list every time, so nothing is forgotten when people are tired.

AreaWhat to checkWhat a good answer looks like
etcd membersMember list and health on every endpointAll members present, one leader, no errors
API serverHealth endpoints and a simple readFast responses with no storage errors in the logs
NodesNode list and statusAll expected nodes are Ready, stale ones are identified
System PodsDNS, networking and controller componentsRunning and not restarting repeatedly
WorkloadsDeployments, StatefulSets and JobsDesired and ready counts match
StorageVolume claims and their volumesBound, with matching disks in the storage system
SecretsReading a few known SecretsReadable, which proves the encryption key works
Access controlA few known users and service accountsPermissions match what is expected
Custom resourcesOperators and their objectsOperators are running and objects are consistent
End usersA real request through the front doorApplications answer correctly

Record the gap

Write down the time of the snapshot and the time of the failure. That window is the data you lost. Share it with the application teams so they know exactly which changes to re-apply and which data to check. A clear statement of the gap helps people repair their own areas much faster than a general warning.

i
Good Practice

Keep your application manifests in source control with a pipeline that can re-apply them. After a restore, re-running the pipeline brings back recent changes in minutes instead of hours.

22Partial Recovery: Pulling a Few Objects from a Snapshot

When the cluster is healthy and only some objects were lost, restoring everything is far too heavy.

Suppose a person deletes one namespace by mistake. The rest of the cluster is fine and has changed a lot since last night’s snapshot. If you restore the whole snapshot, you lose all of those changes just to bring back one namespace. A much better approach exists: restore the snapshot into a separate, temporary etcd that is not connected to your real cluster, read the objects you need from it, and re-create them in the live cluster.

1

Prepare a scratch machine

Use a separate computer or a throwaway virtual machine, completely isolated from the production network.

2

Restore the snapshot there

Build a one-member etcd from the snapshot file and start it on the scratch machine.

3

Find the objects

Either read the keys directly from this etcd, or attach a temporary API server to it so you can use the normal tools to list and export the objects.

4

Clean the exported objects

Remove fields that belong to the old cluster, such as unique identifiers, version numbers, status and owner references that point to objects that no longer exist.

5

Apply them to the live cluster

Create the objects in the right order: namespaces first, then configuration, then storage claims, then workloads.

Simple Analogy

If you spill coffee on one page of a notebook, you do not throw away the whole notebook and use last month’s copy. You find the old copy, read the lost page, and write it again in the current notebook.

!
Common Mistake

Connecting the scratch etcd to the real network, or letting it use the same certificates and addresses as production. Keep it isolated so that it can never be mistaken for a member of the real cluster.

23Worked Example One: Two of Three Control Plane Nodes Lost

A story that follows the whole process from alarm to normal operation.

A company runs a production cluster with three control plane machines in three zones. One night, a mistake in an infrastructure script deletes two of the three machines along with their disks. The survivor is still running but the cluster has lost quorum. Alerts fire because the API server is timing out. Applications continue to serve traffic, but nobody can deploy anything and autoscaling has stopped.

sequenceDiagram
  participant Ops as On-call engineer
  participant Store as Offsite storage
  participant N1 as Surviving node
  participant N2 as New node 2
  participant N3 as New node 3
  Ops->>Ops: Confirm quorum is lost and disks are gone
  Ops->>Store: Fetch latest verified snapshot
  Ops->>N1: Stop API server and etcd
  Ops->>N2: Build machine and copy certificates and snapshot
  Ops->>N3: Build machine and copy certificates and snapshot
  Ops->>N1: Restore snapshot into new data folder
  Ops->>N2: Restore snapshot into new data folder
  Ops->>N3: Restore snapshot into new data folder
  Ops->>N1: Start etcd then API server
  Ops->>N2: Start etcd then API server
  Ops->>N3: Start etcd then API server
  Ops->>Ops: Restart controllers and kubelets then validate
        
FIG 5 — Rebuilding a three-member control plane from a snapshot
1

Assess

The engineer checks the member list and sees only one member responding. The disks of the other two are confirmed lost, so those members cannot return.

2

Choose the path

The surviving member holds data, and the team considers the single-member restart option. But that node’s disk shows errors from the incident, so they choose the safer snapshot restore.

3

Rebuild machines and gather files

Two new control plane machines are created from code. The certificates, encryption key and the verified snapshot from forty minutes earlier are copied to all three machines.

4

Restore and start

Each member is restored from the same snapshot with its own name and address and the shared member list. etcd is started first, a leader is elected, and then the API servers start.

5

Reconcile

The team restarts the other components and tells application owners that changes made in the last forty minutes must be re-applied. The pipeline re-applies them within the hour.

The result: about forty minutes of changes were lost, but running applications never stopped serving traffic. The team writes down what went well and what was slow, and they fix the script that deleted the machines. They also add a stronger approval step for deleting control plane machines.

24Worked Example Two: An Accidentally Deleted Namespace

This time the cluster is perfectly healthy, which makes the full restore the wrong tool.

At eleven in the morning, an engineer meant to clean up a test namespace and deleted the namespace of a payments service instead. The cluster accepted the request. All the Deployments, Services, ConfigMaps, Secrets and volume claims in that namespace began to disappear. Every etcd member faithfully copied the deletion.

Step 1: Stop the damage

The team first checks whether the deletion is still in progress. If some objects are only waiting on finalizers, they may be saved. They pause any automation that could make things worse, and they check the reclaim policy of the storage volumes, because volumes set to delete will be removed along with their claims.

Step 2: Pick the right snapshot

The latest snapshot was taken at ten o’clock, one hour before the mistake. It contains the whole namespace. A full restore would erase all other teams’ changes from the last hour, which is unacceptable for a mistake that affects only one namespace.

Step 3: Use a scratch etcd

The team restores the ten o’clock snapshot into an isolated etcd and reads out the payments namespace objects, cleaning the fields that belong to the old cluster.

Step 4: Recreate in the live cluster

They create the namespace, then configuration and Secrets, then volume claims, and finally the Deployments. The workloads start up again with the settings they had at ten o’clock.

Step 5: Deal with the data

The payment database’s volume had a delete reclaim policy, and the disk was gone. Recreating the claim gives an empty disk. The team restores the data from the most recent volume snapshot and database backup, which is why those backups matter just as much as etcd snapshots.

!
Lesson

An etcd snapshot restores definitions, not the contents of disks. Without volume snapshots or database backups, a perfect restore of the namespace would still leave the payments service with an empty database.

i
Prevention

Use role-based access control to limit who can delete namespaces, set a retain policy on volumes that hold important data, and add a confirmation step for destructive actions in production.

25Other Layers of Protection: Managed Clusters, Velero and GitOps

etcd snapshots are one layer of a good plan, and they work best alongside other layers.

A single backup method rarely covers every need. A strong disaster recovery plan uses several layers, each covering weaknesses of the others. It is useful to know the main ones and what each does well.

LayerWhat it protectsStrengthWeakness
etcd snapshotsThe whole cluster state at one momentComplete, simple, fast to takeRestoring is all-or-nothing and needs direct access to the control plane
GitOps or source controlDesired state of applications as filesEasy to re-apply and review, great for rebuildingDoes not hold data created by hand, Secrets are often kept elsewhere
Resource-level backup tools such as VeleroSelected objects and volume snapshotsCan restore single namespaces and move between clustersDepends on the API server working, and needs setup for each volume type
Volume snapshots and database backupsApplication data on disksProtects the data that etcd never holdsNeeds application-aware care to be consistent
Infrastructure as codeMachines, networks and cloud settingsRebuilds the foundation quickly and repeatablyNeeds discipline so that code matches reality
Standby cluster in another regionThe whole serviceShortest recovery timeHighest cost and the hardest to keep in step

Managed Kubernetes services

On managed services from cloud providers, the provider runs the control plane and etcd for you. You usually cannot reach etcd directly, so you cannot take your own etcd snapshots. The provider takes care of the durability of the control plane and often has its own backup practices, but those are not a promise that they can bring back an object you deleted by mistake. For that reason, teams on managed services rely more on source control, resource-level backup tools and volume snapshots. Read your provider’s documentation carefully to learn what they do and do not restore.

Simple Analogy

Renting an apartment means the landlord looks after the building’s pipes and walls, but you still keep your own insurance for your belongings. In a managed cluster the provider keeps the control plane running, but protecting your objects and data is still your job.

i
Good Practice

Make it a habit to ask, for every kind of failure, which layer would bring it back and how long that would take. If a failure has no answer, you have found a gap in your plan before the gap finds you.

26etcd Health and Capacity: Keeping Snapshots Small and Reliable

A healthy database is easier to back up and much easier to restore.

The size of your snapshot depends directly on the size of the etcd database, and the health of the database affects how quickly you can recover. There are a few ideas that every operator should understand.

The space quota

etcd has a limit on the size of its database, set by a quota. If the database grows past the quota, etcd raises an alarm and stops accepting writes, except for deletions, until the problem is fixed. The cluster becomes effectively read-only, which looks like an outage. The default limit is a couple of gigabytes, and the project recommends keeping the database comfortably below a fairly small upper bound, because very large databases are slow to snapshot, to restore and to sync to new members.

Compaction and defragmentation

etcd keeps old versions of every key so that clients can watch for changes. If old versions are never removed, the database grows without end. Compaction removes versions older than a chosen point. The Kubernetes API server runs compaction on a regular basis by itself. But compaction only marks space as free inside the file. The file on disk stays large until defragmentation rewrites it into a smaller one. Defragmentation of a member briefly blocks it, so it is done one member at a time, and not on the leader first.

Idea 1

Quota

The maximum database size. Passing it causes a write-blocking alarm, so watch the size well before it gets close.

Idea 2

Compaction

Throws away old versions of keys. It is done automatically by the API server on a short cycle.

Idea 3

Defragmentation

Shrinks the file on disk after compaction. Do it member by member during quiet periods.

Idea 4

Object hygiene

Large numbers of Events, Jobs, ConfigMaps or custom resources are the usual cause of growth. Clean them up regularly.

Simple Analogy

Think of a notebook where you never erase, you only cross out old lines. Compaction is deciding which crossed-out lines nobody will ever read again. Defragmentation is copying the useful pages into a fresh, thinner notebook so that it fits in your bag.

!
Common Mistake

Raising the quota without finding out why the database grew. A larger limit only postpones the alarm. A runaway controller that creates thousands of objects will fill any quota you set.

i
Good Practice

Run etcd on fast local solid-state disks. Slow disks cause slow writes, leader changes and sometimes failed snapshots, and they slow every restore as well.

27Monitoring and Alerting for Backups and etcd

You want to hear about a problem when it is small, not when you need the backup.

Monitoring for disaster recovery has two jobs. The first is to watch the health of etcd, so that you catch trouble early. The second is to watch the backup system itself, so that you know a good backup exists at all times.

What to watchTypical signalWhy it matters
Time since last good snapshotAge of the newest verified file in remote storageThe most important backup alert. If it grows beyond your RPO, you are exposed
Snapshot size and key countCompare to recent historySudden drops hint at mass deletion or a broken job
Backup job statusFailed or missing runsCatches a silent failure early
Leader presenceWhether a leader existsNo leader means no writes
Leader changesNumber of elections over timeFrequent elections point to slow disks or network trouble
Disk speedTime taken to sync the log and commit dataSlow disks are the most common cause of etcd instability
Database sizeSize compared to the quotaWarns before the write-blocking alarm
Failed proposalsCount of rejected changesIndicates quorum or leadership problems
Certificate expiryDays until etcd and control plane certificates expireAn expired certificate can look just like a disaster

Alerts that deserve a human

Not every number needs to wake someone up. A good rule is to page a person when the age of the newest good backup exceeds the target, when quorum is at risk, or when the database is close to its quota. Other signals can create tickets or dashboard warnings.

i
Good Practice

Check the backup age from outside the cluster, using the backup storage itself as the source of truth. If you ask the cluster whether its backups are fine, and the cluster is the thing that is broken, you will not get an honest answer.

28Security of Snapshots and the Recovery Process

A snapshot is a copy of everything, so it deserves the same protection as everything.

Anyone who can read a snapshot, and who has the encryption key if one is used, can read every Secret, every service account setup and every configuration in the cluster. Anyone who can write a snapshot into your recovery process could plant a poisoned cluster state during a restore. Both risks must be handled.

Control 1

Protect access to etcd

Only the API servers and the backup job should be able to connect, using mutual TLS. No other tool or person should have routine access.

Control 2

Encrypt backups

Encrypt files in storage and while they travel, and keep the keys in a different place from the files.

Control 3

Restrict and log access

Keep the list of people who can read or restore snapshots very short, and record every access.

Control 4

Use immutable storage

Turn on features that prevent deletion or change for a time, which protects against ransomware and mistakes.

Control 5

Verify before trusting

Check hashes and the source of a snapshot before you restore from it, especially if it came from another person or place.

Control 6

Rotate secrets after a restore

If a snapshot may have been exposed, change the Secrets inside it. A restore from an exposed snapshot returns the exposed values too.

Simple Analogy

A bank vault keeps its master list of safe-deposit boxes in a locked room that few people may enter, and keeps a sealed copy at another branch. The copy is just as sensitive as the original, so it is locked, logged and guarded in the same way.

!
Common Mistake

Sending snapshots by email or placing them in a shared folder “just for this restore”. Temporary shortcuts have a habit of becoming permanent exposure. Use the same protected path every time.

29Anti-Patterns to Avoid

These mistakes appear again and again in real incidents, and each has a simple cure.

ANTI-PATTERN-01 Avoid
Problem

Taking snapshots but never testing a restore.

Why It’s Harmful

The first real test happens during an emergency. Missing certificates, a wrong tool version or a corrupted file are discovered when time is most precious.

Correct Approach

Restore into a scratch environment on a regular schedule, read real objects from it, and treat a failed test as an incident.

ANTI-PATTERN-02 Avoid
Problem

Keeping snapshots only on the control plane machines.

Why It’s Harmful

The failure that destroys the machines destroys the backups too. This is exactly the situation in which the backups are needed.

Correct Approach

Copy every snapshot to separate, protected storage in another location right after it is created.

ANTI-PATTERN-03 Avoid
Problem

Forgetting to back up the certificates and the encryption key.

Why It’s Harmful

A restored cluster cannot trust its own components, and encrypted Secrets cannot be read. The snapshot is then of little use.

Correct Approach

Back up the certificate folder and the encryption configuration separately, with strong protection and a documented location.

ANTI-PATTERN-04 Avoid
Problem

Restoring while an API server is still running.

Why It’s Harmful

The API server may write into a half-restored database or keep stale information in memory, which produces mixed and confusing state.

Correct Approach

Stop every API server first, restore all etcd members, start etcd, then start the API servers and restart the other components.

ANTI-PATTERN-05 Avoid
Problem

Believing that three etcd members are a backup.

Why It’s Harmful

Members copy changes to each other immediately, including mistakes and deletions. Replication protects against machine failure, not against bad data.

Correct Approach

Use replication for availability and snapshots for recovery, and understand that they solve different problems.

ANTI-PATTERN-06 Avoid
Problem

Ignoring application data and relying on etcd snapshots alone.

Why It’s Harmful

A restored cluster brings back definitions but not the contents of volumes, so databases may come back empty.

Correct Approach

Plan volume snapshots and database-level backups together with etcd backups, and test them as a set.

30Runbooks, Drills and the Trade-Offs of Snapshots

Technology gets you the file, but practice gets you the recovery.

The best backup system in the world does not help a team that has never practiced. A written runbook is a step-by-step guide for each kind of failure. It should be short, tested and stored somewhere that does not depend on the cluster being alive. A drill, sometimes called a game day, is a planned practice where the team follows the runbook on a test cluster and measures how long each step takes.

1

Write the runbook

Describe each scenario, how to recognize it, the exact steps and who may approve a restore. Include where every file and key can be found.

2

Rehearse on a copy

Build a test cluster that resembles production and practice the restore from a real snapshot. Time every stage.

3

Compare with your goals

Check whether the measured recovery time meets the RTO and whether the snapshot interval meets the RPO.

4

Fix what was slow or unclear

Automate repeated steps, clarify confusing instructions and add missing items to the checklist.

5

Repeat regularly and after big changes

Repeat the drill on a schedule and after upgrades, changes of storage, new regions or changes of team.

Advantages of etcd snapshots

  • Capture the whole cluster state in one simple file
  • Can be taken while the cluster keeps running
  • Small compared with application data
  • Supported by the etcd project itself
  • Allow full rebuilds and partial extraction

Disadvantages / Trade-offs

  • Only as fresh as the last snapshot, so some data is always lost
  • Restoring is all-or-nothing for the live cluster
  • Do not hold application data, certificates or encryption keys
  • Contain sensitive data and need careful protection
  • Need direct access to etcd, which managed services usually hide
i
Good Practice

After each drill and each real incident, hold a short review without blame. The aim is to improve the system and the runbook, not to find someone to criticize.

31Troubleshooting Backups and Restores

Most problems fall into a handful of patterns, each with an obvious first check.

SymptomLikely causeWhat to check first
Snapshot command fails to connectWrong endpoint or missing credentialsConfirm the member address and the certificate authority, client certificate and key files
Connection works but is rejectedClient certificate not trusted or expiredCheck certificate dates and which authority signed them
Snapshot file is tiny or emptyJob ran against the wrong target or was cut offCheck job logs and compare with earlier file sizes
Restore says the folder already existsRestore never overwrites existing dataChoose a new folder and keep the old one aside
Restore reports a hash problemFile was damaged or came from a data folder copyVerify the transfer checksum and use an earlier snapshot if needed
Members refuse to join each otherDifferent tokens, lists or mismatched certificatesCompare the member list and token on every machine
etcd starts but API server failsAPI server cannot reach etcd or has stale flagsCheck endpoints, certificates and the API server logs
Secrets cannot be read after restoreEncryption key is missing or wrongCheck the encryption configuration and key service access
Controllers behave strangely afterwardComponents still hold stale informationRestart controller manager, scheduler and kubelets
Writes fail with a space alarmDatabase exceeded its quotaCompact, defragment, then clear the alarm and find the source of growth

A calm way to investigate

Start by writing down exactly what you see, including error messages and times. Check one layer at a time, from the network to certificates, to etcd members, to the API server, to the controllers. Resist the temptation to change many things at once, because then you will not know which change helped. If you are unsure, stop and keep the old data folders so that you can return to a known state.

!
Common Mistake

Deleting the old data folders to “start clean”. If the restore later turns out to be wrong, the old data may have been your better source. Keep it until the new cluster has been validated and used for a while.

32Real-World Situations Where Snapshots Save the Day

The same technique shows up in many kinds of organizations, for different reasons.

An online retailer after a zone outage

A cloud zone fails during a sales event and takes two control plane machines with it. The team rebuilds the control plane in healthy zones from a recent snapshot, while the shop keeps serving customers from the running nodes.

A software company after a bad migration

A storage version migration of a custom resource damages thousands of objects. Rolling back the software does not fix the data. A snapshot taken before the migration lets the team recover the objects they need.

A bank with strict audit rules

Regulators require proof that the platform can be recovered. The bank keeps immutable, encrypted snapshots in a second region and records the results of quarterly restore drills as evidence.

A start-up that deleted a namespace

A tired engineer deletes the wrong namespace. The team restores the previous snapshot to a scratch environment, pulls out the namespace objects and recreates them, avoiding a full restore.

An organization hit by ransomware

Attackers encrypt the data on the control plane disks. Because snapshots were stored in locked, write-once storage, the team rebuilds clean machines and restores a snapshot taken before the attack, then rotates every secret.

A platform team moving clusters

A team needs to move to new hardware. They use a snapshot to create the new cluster with the same objects, then switch traffic over after testing, using the snapshot as a migration tool as well as a safety net.

33Recovery in Different Cluster Layouts

The same snapshot idea works everywhere, but the practical steps change with the shape of the cluster.

Not all Kubernetes clusters are built the same way. Some run etcd on the same machines as the API server. Some run etcd on its own separate machines. Some are tiny single-machine clusters for testing, and some are spread across several regions. Knowing your layout before disaster strikes tells you which steps in the runbook apply to you.

Stacked etcd: the common kubeadm layout

In a stacked layout, each control plane machine runs an API server and also an etcd member. This is simple to set up and uses fewer machines. The downside is that the two are tied together: if you lose a machine, you lose both an API server and an etcd member at the same moment. Recovery steps involve the same machines for both parts, and static Pod files on each machine control both.

External etcd: a separate database tier

In an external layout, etcd runs on its own dedicated machines, and the API servers connect to it across the network. This costs more machines but separates the failure of an API server from the failure of the database. During recovery, you restore etcd on its own machines first, check it is healthy, and then point the API servers at it. This separation makes it easier to rehearse and to reason about, because there are fewer moving parts on each machine.

Stacked etcd

  • Fewer machines to buy and look after
  • Simple to set up with common tools
  • Good fit for small and medium clusters

Disadvantages of stacked etcd

  • Losing one machine loses both an API server and a database member
  • Heavy API load can compete with etcd for the same resources
  • Recovery touches many components on the same machine

External etcd

  • Database and API servers fail independently
  • Disks and memory can be tuned just for etcd
  • Restore can be done and tested on the database tier alone

Disadvantages of external etcd

  • More machines, more certificates and more networking to manage
  • One more tier to monitor, patch and secure
  • Mistakes in addresses between tiers are easy to make
LayoutWhere the snapshot is takenWhere the restore happensSpecial care
Stacked, three control plane nodesFrom one member on a control plane nodeOn every control plane nodeStop and start both the API server and etcd static Pods on each node
External etcd tierFrom one member on the etcd machinesOn every etcd machine, then reconnect the API serversCheck that API server endpoints and certificates still match
Single control plane nodeFrom the only memberOn that node or on a replacement nodeNo redundancy, so the snapshot is your only protection
Multi-region with standbyFrom the primary regionIn the standby region when the primary is lostKeep certificates, keys and addresses ready for the standby site

Single-node clusters

Small clusters used for learning, testing or edge sites often have one control plane machine and one etcd member. There is no quorum protection at all, because there is only one voice. If that machine’s disk is lost, the cluster is gone. For these clusters, a regular snapshot sent to another place is not just a nice extra, it is the only protection that exists. Restoring is simpler, since there is only one member, but the cost of forgetting backups is total.

Standby clusters in another region

For services that cannot tolerate long outages, some organizations keep a second cluster in another region, prepared in advance. Snapshots, certificates and keys are copied there regularly. If the primary region is lost, the team restores the latest snapshot into the standby, redirects traffic and carries on. This gives the shortest recovery time, but it is expensive and needs constant care to keep the two sides in step, including the application data that lives outside etcd.

Simple Analogy

A family keeps one spare house key under the flowerpot, which is cheap and quick but risky. A bigger family may keep a spare key with a neighbor, another with a relative in another city, and a copy in a bank box. The more important the house, the more spread out the spare keys should be.

!
Common Mistake

Copying a runbook from a different kind of cluster without adjusting it. Steps that fit a stacked layout can be wrong for an external one, and the difference often only appears when you are in the middle of an incident.

i
Good Practice

Keep a short diagram of your cluster layout next to the runbook, showing which machines run which components and where each certificate lives. A clear picture speeds up every decision during recovery.

34Snapshots Around Upgrades and Big Changes

Many disasters begin as planned changes, so the safest time to take a snapshot is right before one.

Upgrades of Kubernetes and of etcd are among the riskiest routine tasks. Newer versions may change how data is stored, add new fields, or migrate objects from one stored version to another. Once that happens, rolling the software back may not undo the data change. A snapshot taken just before the change gives you a clean way back, even if the software cannot go backward by itself.

1

Check health first

Confirm that all etcd members are healthy, that a leader exists and that nothing is already failing. Never begin an upgrade on an unhealthy cluster.

2

Take a fresh snapshot

Make a new snapshot immediately before the change, verify it and copy it to offsite storage. Do not rely on the one from this morning.

3

Save the configuration

Copy the control plane manifests, certificates and encryption configuration, so you know exactly what the cluster looked like before.

4

Upgrade one step at a time

Move through one control plane node at a time, checking health after each. Follow the supported order and version steps and do not skip versions.

5

Verify and keep the snapshot

When everything is healthy, keep the pre-upgrade snapshot for a good while, because some problems only show up days later.

flowchart LR
  H["Healthy cluster"] --> S["Pre-change snapshot"]
  S --> U["Upgrade or big change"]
  U --> Q{"Problems?"}
  Q -->|No| K["Keep snapshot for some time"]
  Q -->|"Yes, fixable"| F["Fix forward"]
  Q -->|"Yes, severe"| R["Restore from pre-change snapshot"]
        
FIG 6 — A pre-change snapshot gives you a safe way back

Matching versions

The tool that restores a snapshot should be compatible with the version of etcd that wrote it. Using a very different version of the tool can lead to surprises. It is also wise to restore using an etcd version that is the same as, or a supported neighbor of, the one the snapshot came from. Keep note of which Kubernetes and etcd versions were running when each snapshot was made, for example in the file name or in a small text file stored next to it. That note can save a lot of guessing months later.

Other big changes

Upgrades are not the only risky operations. A bulk deletion of old objects, a change of the encryption setup, the installation of a new operator that rewrites custom resources, a storage migration or the replacement of control plane machines all deserve a snapshot first. A good habit is to make taking a snapshot the first line of every change checklist for production.

Before 1

Control plane upgrades

Take and verify a snapshot, and keep it until the new version has run safely for a while.

Before 2

Encryption changes

When rotating or changing keys, snapshot first and keep both old and new keys until you are sure of the result.

Before 3

Bulk cleanups

Before deleting many objects, snapshot, so a wrong filter does not become a permanent loss.

Before 4

Operator or CRD changes

New versions of operators can rewrite their objects. A snapshot lets you undo a bad rewrite.

Simple Analogy

Before a mountaineer crosses a risky ridge, the team leaves a marked camp behind with food and supplies. If the crossing goes badly, they know where to return. A pre-change snapshot is that camp, and it is cheap to build compared with the trouble it can prevent.

!
Common Mistake

Assuming that you can always downgrade the software to undo an upgrade. Data formats and stored versions may have changed, so going back can be unsupported or unsafe. The snapshot is what gives you a real return path.

i
Good Practice

Practice the upgrade and the rollback on a non-production copy built from a real snapshot. This tests both your upgrade steps and your backups in a single exercise.

35Building Your Own Recovery Plan, Step by Step

All the ideas in this guide come together in one short document that your team can actually use.

Knowing the theory is useful, but when an incident begins, people need a plan they can follow without thinking too hard. A recovery plan turns everything above into a small set of decisions, owners and steps. You can build one in an afternoon and improve it over time. The pieces below are a good order to work in.

Step one: list what you must protect

Start with a plain inventory. Write down every cluster, what it is used for, who owns it and how important it is. For each one, write down which data lives in etcd, which lives on volumes, and which lives outside the cluster altogether, such as in managed databases or object storage. This list quickly shows which clusters need the strongest protection and which can be rebuilt from code with little loss.

Step two: agree on goals

For each cluster, agree on the recovery point goal and the recovery time goal with the people who depend on it. Write them next to the inventory. These two numbers drive almost every other choice, from how often to snapshot to how much to spend on a standby site.

Step three: choose the layers

Decide which layers of protection each cluster gets. Some may need only etcd snapshots and source control. Others may need volume snapshots, database backups, immutable offsite copies and a standby cluster. Write down who is responsible for each layer, because a layer that belongs to everyone usually belongs to no one.

Step four: automate and monitor

Set up scheduled snapshots, automatic copies to remote storage, automatic checks of the files, and alerts when anything is late or missing. Make the system loud when it fails and quiet when it works.

Step five: write the runbooks

Write short runbooks for the main situations: one member lost, quorum lost, whole control plane lost, data corrupted, and a single namespace deleted. Each should say how to recognize the situation, who decides, and the exact steps. Keep them in a place that does not depend on the cluster being up.

Step six: practice and improve

Schedule drills, measure the results against your goals, and fix what you find. Review each real incident the same way. Over time, the plan becomes shorter, clearer and more reliable.

Role during an incidentMain jobWhy it helps
Incident leadMakes decisions, decides when to restore, talks to managementOne clear voice prevents confusion and conflicting actions
OperatorRuns the commands on the machinesKeeps hands on the keyboard focused on the technical work
ReviewerReads each step aloud and checks it against the runbookCatches typing mistakes before they cause damage
ScribeRecords times, commands and resultsCreates the record needed for the review afterward
CommunicatorUpdates teams and customersFrees the others from interruptions and keeps people informed
Document 1

Inventory and goals

Which clusters exist, who owns them, and what recovery point and recovery time each one needs.

Document 2

Location sheet

Where snapshots, certificates, keys and tools are kept, and who may open them.

Document 3

Runbooks

Step-by-step guides for each failure situation, tested in drills and stored outside the cluster.

Document 4

Contact list

Who to call for storage, networking, security, application owners and management, with backups for each person.

Document 5

Drill log

Dates and results of past practice runs, with the measured recovery times and the fixes that followed.

Document 6

Review notes

Short, blame-free summaries of real incidents with the changes that came out of them.

A final readiness check

Once the plan exists, test it with a few blunt questions. Ask each of them out loud, and be honest about the answers. If any answer is “I am not sure”, that is the next item on your work list.

Can we find the newest snapshot in under five minutes?

If people must search through several buckets and folders, the first minutes of a real incident will be wasted. The location sheet should lead straight to the newest verified file.

Do we hold every key needed to read it?

Check that the certificates, the encryption configuration and any key service access are available outside the cluster, and that the people who can reach them are available at night and on holidays.

Has someone restored it recently?

A restore done within the last few months, with the date written in the drill log, is worth far more than a hundred snapshots that were never opened.

Do application owners know what they must re-apply?

Teams should know that changes made after the snapshot time will be gone, and they should know where their manifests and data backups live so that they can repair their own areas quickly.

Would we notice if backups stopped tonight?

An alert on the age of the newest good snapshot answers this. If nothing would tell you, the system is relying on luck, and luck is not a recovery strategy.

Does the plan survive the loss of its author?

A runbook that only one person understands is a single point of failure. Ask a colleague who did not write it to follow it during a drill, and note every place where they hesitate or ask a question.

Is the recovery budget realistic?

Rebuilding machines, copying large files and restoring volumes all take real time. Compare the measured duration of each step in your last drill with your recovery time goal, and decide honestly whether the goal or the plan must change.

Simple Analogy

A ship’s captain keeps a clear emergency plan that says who goes to which lifeboat, where the flares are and who gives the orders. Nobody reads it for the first time while the ship is sinking, because the crew has practiced it many times. A recovery plan does the same job for a cluster.

i
Good Practice

Keep a printed or offline copy of the location sheet and the main runbook. If the cluster, the network and the wiki are all down, the paper copy is still readable.

!
Common Mistake

Writing a perfect plan once and never looking at it again. People change jobs, machines are replaced and versions move forward. A plan that is not reviewed at least twice a year slowly becomes a story about a cluster that no longer exists.

36Frequently Asked Questions

Short answers to questions that beginners often ask.

Q1Do I have to stop the cluster to take a snapshot?

No. A snapshot is taken from a running member and gives a consistent picture of a single moment. The cluster keeps working while it is made, with only a small extra load on that member.

Q2How often should I take snapshots?

Often enough to meet your recovery point goal. Many production teams take one every thirty minutes to one hour. Less critical clusters may be fine with one a day.

Q3Will the running applications stop during a restore?

Not necessarily. Containers on the nodes usually keep running while the control plane is down. But nothing can be changed or scaled, and after the restore the kubelets may stop Pods that the restored state does not know about.

Q4Does a snapshot include my application data?

No. It holds Kubernetes objects only. Data on volumes needs its own backups, such as volume snapshots or database backups.

Q5Why do I need the certificates and the encryption key too?

They are not stored in etcd. Without the certificates the control plane components cannot trust each other, and without the encryption key the encrypted Secrets cannot be read after a restore.

Q6Can I restore a snapshot onto a cluster that has different machines?

Yes. A restore builds a new etcd with a new identity, and you can place it on new machines as long as addresses, certificates and configuration are set up consistently.

Q7What is the difference between a snapshot and copying the data folder?

A snapshot is made by etcd itself and is consistent and verifiable. Copying files from a running member may capture them in the middle of a write and produce a file that cannot be trusted.

Q8Can I get back one deleted object without restoring everything?

Yes. Restore the snapshot into a separate scratch etcd, read the objects you need, clean the fields that belong to the old cluster, and create them in the live cluster.

Q9Are three etcd members enough to protect me from data loss?

They protect against the loss of one machine. They do not protect against mistakes, corruption or the loss of several machines, because every member copies every change. Snapshots cover those cases.

Q10Can I take etcd snapshots on a managed Kubernetes service?

Usually not, because the provider hides etcd. In that case, rely on source control, resource-level backup tools and volume snapshots, and read the provider’s documentation about what they restore.

Q11How do I know my backup is good?

Check the file’s status right away, compare its size with earlier ones, verify the copy in remote storage, and most importantly, restore it to a scratch environment on a regular schedule.

Q12What should I do first when something seems wrong?

Stay calm and check the health and member list of etcd. Many problems can be solved by replacing one member or repairing a machine, without any restore at all.

37Summary and Key Takeaways

etcd is the memory of a Kubernetes cluster. If it is lost or damaged, the cluster forgets what it was running. Replication across members protects against the failure of a machine, but only snapshots protect against corruption, mistakes and the loss of a majority of members. A good plan sets recovery goals first, takes snapshots automatically from a healthy member, verifies them, stores them safely in another place, and keeps the certificates and encryption key alongside, but apart from, the files. When disaster comes, the team chooses the lightest fix that works, stops the writers, restores every member from the same snapshot into a new data folder, starts etcd and then the control plane, restarts the other components, and validates the result carefully. Regular drills turn all of this from a hopeful idea into a dependable skill.

Key Takeaways

  • etcd holds the cluster’s memory — losing it means losing the desired state of everything, even while containers keep running.
  • Replication is not backup — members copy mistakes and deletions instantly, so you need snapshots to go back in time.
  • Choose the lightest fix — replace a failed member or repair machines when quorum can return, and use a snapshot only when the data is truly lost or wrong.
  • Back up the missing pieces — snapshots do not hold certificates, encryption keys, application volumes or machine configuration.
  • Store safely and verify — keep encrypted, immutable copies offsite, check every file, and prove restores work by testing them.
  • Restore as a group — stop all API servers, restore every member from the same snapshot into new data folders, start etcd, then the control plane, and restart the other components.
  • Practice makes recovery calm — set RPO and RTO, write runbooks, run drills, and measure so that the real day feels familiar.