How to restore only a namespace from etcd backup?

Someone deleted a namespace in the cluster, having etcd backup before deleting it. How can I restore only a specific namespace without recovering the entire cluster?

I don’t think this can be done. It’s all or nothing.
You could restore the backup to a fresh cluster then get the workloads off that.

Ideally you should simply be able to redeploy the namespace from manifests or charts which you should have in source control.

Why is it is like that, normally If I execute kubectl get deployment/app -o yaml, the yaml is given, is it not from etcd?

Can we open that etcd backup file and individuals check for the file and copy required?

It is a backup - a binary dump of everything.
You can’t extract one table from an SQL server backup - you have to restore the whole thing. Same with etcd.

That’s why, if you want to pick at the backup, you would have to restore it into another cluster, and then run kubectl get command on there.

But I say again, if it’s the manifests you need to recover, don’t you have them in source control?

1 Like

I am new to those things, and we are building our skill sets.
I was just curious about it. After Linux basics and docker basis, I am directly learning K8S.

Thank You.