rancher / rke

Rancher Kubernetes Engine (RKE), an extremely simple, lightning fast Kubernetes distribution that runs entirely within containers.
Apache License 2.0
3.21k stars 581 forks source link

`rke etcd snapshot-restore` doesn't use this configuration and restores snapshot to a wrong directory #2547

Open Zebradil opened 3 years ago

Zebradil commented 3 years ago

I have custom directories for etcd data and wal files. rke etcd snapshot-restore doesn't use this configuration and restores snapshot to a wrong directory.

RKE version: v1.2.8

Docker version:

Client:
 Version:           20.10.6
 API version:       1.41
 Go version:        go1.16.3
 Git commit:        370c28948e
 Built:             Mon Apr 12 14:10:41 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.6
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.3
  Git commit:       8728dd246c
  Built:            Mon Apr 12 14:10:25 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.5.1
  GitCommit:        12dca9790f4cb6b18a6a7a027ce420145cb98ee7.m
 runc:
  Version:          1.0.0-rc94
  GitCommit:        2c7861bc5e1b3e756392236553ec14a78a09f8bf
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Operating system and kernel: Arch Linux, 5.12.4-arch1-2

Type/provider of hosts: Openstack

cluster.yml file:

# trimmed
services:
  etcd:
    extra_args:
      # scale etcd disk performance, see https://rancher.com/docs/rancher/v2.x/en/installation/options/etcd/
      data-dir: "/var/lib/rancher/etcd/data/"
      wal-dir: "/var/lib/rancher/etcd/wal/wal_dir"
    extra_binds:
      - "/var/lib/etcd/data:/var/lib/rancher/etcd/data"
      - "/var/lib/etcd/wal:/var/lib/rancher/etcd/wal"
# trimmed

Steps to Reproduce:

  1. Create RKE cluster using custom paths for data-dir and wal-dir arguments
  2. Create a snapshot with rke etcd snapshot-save
  3. Restore snapshot with rke etcd snapshot-restore

Results:

The snapshot is restored into a directory, which is not mounted to the etcd containers, etcd uses the pre-restore data.

Zebradil commented 3 years ago

I got it working by patching the code, preparing a PR currently.

superseb commented 3 years ago

I'm looking at this

fritzduchardt commented 3 years ago

Any update on this? Ran into the same issue and can restore backups only with @Zebradil fix.

superseb commented 3 years ago

It will go in later, with current code freeze it won't go in next release.