Rancher 2.0 backup

  • Where can I find the best practices for backup in Rancher 2.0?
  • Is there a mysql database like Rancher 1.6?
  • Should I create persistent volumes for the kubernetes cluster?

Is there a documentation for this? Sorry if it’s a silly question.

We made a HA Server Install - 3 nodes.


The version 2.0 uses ETCD to persist cluster data, it is a Kubernetes cluster, I think backing up the ETCD is enough to get it working again, but I don’t know how to do that.

1 Like

If you did an HA installation (= deploying Rancher Server into an existing Kubernetes cluster), that would mean, that you have created at least 3 etcd-nodes in Kubernetes.
This is where Rancher 2.x stores its configuration automatically.
Due to triple replication of the etcd database, a backup shouldn’t be necessary, but anyways, you could probably find some clues in here: https://coreos.com/etcd/docs/latest/op-guide/recovery.html
In a “normal” Rancher setup, it uses an internal etcd and stores it into /var/lib/rancher which could be backed up simply by bind-mounting it as a volume and then copying it to somewhere else.

1 Like

@amioranza@thklein Thank you! I’ll do the bind-mounting for /var/lib/rancher. After reading “etcd-backup-and-restoration” I’m not sure is it’s necessary.

We have this After Installation page that should help us in configuring backup, but I just can’t figure it out https://rancher.com/docs/rancher/v2.x/en/installation/after-installation/etcd-backup-and-restoration/

If anyone that is more experienced can explain it would be great.

I tried with snapshot option, but i get fatal error:
FATA[0000] Failed to resolve cluster file: Can not find cluster configuration file: open $PWD/cluster.yml: no such file

For the automatic backup I don’t know if I should create different file that will run etcd-backup container, because it’s not running on the 3 nodes that I have. If yes what is the command to enable that container.

@penevigor I think this page “Etcd Backup And Restoration” is new. I’ll take a look in it. Thank you.

I did RKE update and followed this instructions: https://github.com/rancher/rke#etcd-backup-and-restoration

Maybe you need specify the config file name. For example:
$rke_linux-amd64 etcd backup --config 3-node-certificate.yml

Actually it looks for a cluster.yml file that I’ve found in the same directory from where I executed the installation. I am not sure if it was auto created by the installation process or I created it later when I tried different stuff. The snapshot backup is now working, but I still think the procedure can be more beginner friendly :slight_smile:

P.S. You can check example of the cluster file on the following link, hope it helps:

I’ve got another question…
We did install rancher2 on a DRBD-backed VM outside of kubernetes. Am i correct that the rancher-etcd has no connection to the cluster-etcd? Meaning i should backup the kubernetes-etcd in a separate way?

1 Like

I have the same question.
Anyone knows if this etcd for rancher is enough to backup all the data from clusters? For example, I have one installation of Rancher 2.0.x that connects to one cluster for staging. This cluster have three etcds, three controls and some workers. What i have to backup?

The management server itself contains stuff like access control config, the list of clusters, projects, users and who should have access to them, etc.

Individual clusters are self-contained and have the definitions of workloads/services/volumes/etc running in that cluster. (it is not “all in the server DB”, like in 1.x. Conversely, if you have clusters that are running fine and lose the server, the workloads and their definitions are still there).

So you need to back up both.

Thanks for the reply.
I will work on it.

@vincent, could you please help me out on folders that need to be backed up on the additional clusters that are created?
I have 3 nodes that play “All” role and few worker nodes. Do I have to back up the etcd folders on the three “All” nodes? or something else.

Sarma K