1
0
mirror of https://github.com/rancher/rke.git synced 2025-08-02 07:43:04 +00:00

Fix etcd restore issue

This commit is contained in:
galal-hussein 2018-05-15 00:00:45 +02:00 committed by Alena Prokharchyk
parent 20c05ee5ad
commit f75ab86027
2 changed files with 8 additions and 7 deletions

View File

@ -459,17 +459,17 @@ Backups are saved to the following directory: `/opt/rke/etcdbackup/`. Backups ar
RKE also added two commands that for etcd backup management:
```
./rke etcd backup [NAME]
./rke etcd backup --name NAME
```
and
```
./rke etcd restore [NAME]
./rke etcd restore --name NAME
```
The backup command saves a snapshot of etcd in `/opt/rke/etcdbackup`. This command also creates a container for the backup. When the backup completes, the container is removed.
The backup command saves a snapshot of etcd from each etcd nodes in the cluster config file and will save it in `/opt/rke/etcdbackup`. This command also creates a container for the backup. When the backup completes, the container is removed.
```
# ./rke etcd backup --name snapshot
# ./rke etcd backup --name snapshot --config cluster.yml
INFO[0000] Starting Backup on etcd hosts
INFO[0000] [dialer] Setup tunnel for host [x.x.x.x]
@ -490,7 +490,7 @@ INFO[0011] Finished backup on all etcd hosts
>**Warning:** Restoring an etcd backup deletes your current etcd cluster and replaces it with a new one. Before you run the `etcd restore` command, backup any important data in your current cluster.
```
./rke etcd restore --name snapshot --config test-aws.yml
./rke etcd restore --name snapshot --config cluster.yml
INFO[0000] Starting restore on etcd hosts
INFO[0000] [dialer] Setup tunnel for host [x.x.x.x]
INFO[0002] [dialer] Setup tunnel for host [y.y.y.y]

View File

@ -29,8 +29,9 @@ func SetUpAuthentication(ctx context.Context, kubeCluster, currentCluster *Clust
backupPlane = ControlPlane
backupHosts = kubeCluster.ControlPlaneHosts
} else {
backupPlane = EtcdPlane
backupHosts = kubeCluster.EtcdHosts
// Save certificates on etcd and controlplane hosts
backupPlane = fmt.Sprintf("%s,%s", EtcdPlane, ControlPlane)
backupHosts = hosts.GetUniqueHostList(kubeCluster.EtcdHosts, kubeCluster.ControlPlaneHosts, nil)
}
log.Infof(ctx, "[certificates] Attempting to recover certificates from backup on [%s] hosts", backupPlane)