Illumina Innovates with Rancher and Kubernetes
One-time snapshots are handled differently depending on your version of RKE.
To save a snapshot of etcd from each etcd node in the cluster config file, run the rke etcd snapshot-save command.
rke etcd snapshot-save
The snapshot is saved in /opt/rke/etcd-snapshots.
When running the command, an additional container is created to take the snapshot. When the snapshot is completed, the container is automatically removed.
The one-time snapshot can be uploaded to a S3 compatible backend by using the additional options to specify the S3 backend.
To create a local one-time snapshot, run:
$ rke etcd snapshot-save --config cluster.yml --name snapshot-name
Result: The snapshot is saved in /opt/rke/etcd-snapshots.
To save a one-time snapshot to S3, run:
$ rke etcd snapshot-save \
--config cluster.yml \
--name snapshot-name \
--access-key S3_ACCESS_KEY \
--secret-key S3_SECRET_KEY \
--bucket-name s3-bucket-name \
--folder s3-folder-name \ # Optional - Available as of v0.3.0
Result: The snapshot is saved in /opt/rke/etcd-snapshots as well as uploaded to the S3 backend.
The --access-key and --secret-key options are not required if the etcd nodes are AWS EC2 instances that have been configured with a suitable IAM instance profile.
Available as of v2.2.5
The backup snapshot can be stored on a custom S3 backup like minio. If the S3 backend uses a self-signed or custom certificate, provide a custom certificate using the --s3-endpoint-ca to connect to the S3 back end.
In addition to API access keys, RKE supports using IAM roles for S3 authentication. The cluster etcd nodes must be assigned an IAM role that has read/write access to the designated backup bucket on S3. Also, the nodes must have network access to the S3 endpoint specified.
Below is an example IAM policy that would allow nodes to store and retrieve backups from S3:
For details on giving an application access to S3, refer to the AWS documentation on Using an IAM Role to Grant Permissions to Applications Running on Amazon EC2 Instances.
RKE saves a backup of the certificates, i.e. a file named pki.bundle.tar.gz, in the same location. The snapshot and pki bundle file are required for the restore process.