From f25da64e0809bf38e0452b98f573c1405de2fe78 Mon Sep 17 00:00:00 2001 From: Brian Downs Date: Wed, 3 Mar 2021 17:48:58 -0700 Subject: [PATCH] K3s Etcd S3 Integration (#3043) * add base s3 documentation Signed-off-by: Brian Downs --- .../k3s/latest/en/backup-restore/_index.md | 43 ++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/content/k3s/latest/en/backup-restore/_index.md b/content/k3s/latest/en/backup-restore/_index.md index a913b68eb2a..ca6aa53ab1a 100644 --- a/content/k3s/latest/en/backup-restore/_index.md +++ b/content/k3s/latest/en/backup-restore/_index.md @@ -59,4 +59,45 @@ These options can be passed in with the command line, or in the [configuration f | `--etcd-snapshot-retention` value | Number of snapshots to retain (default: 5) | | `--etcd-snapshot-dir` value | Directory to save db snapshots. (Default location: `${data-dir}/db/snapshots`) | | `--cluster-reset` | Forget all peers and become sole member of a new cluster. This can also be set with the environment variable `[$K3S_CLUSTER_RESET]`. -| `--cluster-reset-restore-path` value | Path to snapshot file to be restored \ No newline at end of file +| `--cluster-reset-restore-path` value | Path to snapshot file to be restored + +### S3 Compatible API Support + +K3s supports writing etcd snapshots to and restoring etcd snapshots from systems with S3-compatible APIs. S3 support is available for both on-demand and scheduled snapshots. + +The arguments below have been added to the `server` subcommand. These flags exist for the `etcd-snapshot` subcommand as well however the `--etcd-s3` portion is removed to avoid redundancy. + +| Options | Description | +| ----------- | --------------- | +| `--etcd-s3` | Enable backup to S3 | +| `--etcd-s3-endpoint` | S3 endpoint url | +| `--etcd-s3-endpoint-ca` | S3 custom CA cert to connect to S3 endpoint | +| `--etcd-s3-skip-ssl-verify` | Disables S3 SSL certificate validation | +| `--etcd-s3-access-key` | S3 access key | +| `--etcd-s3-secret-key` | S3 secret key" | +| `--etcd-s3-bucket` | S3 bucket name | +| `--etcd-s3-region` | S3 region / bucket location (optional). defaults to us-east-1 | +| `--etcd-s3-folder` | S3 folder | + +To perform an on-demand etcd snapshot and save it to S3: + +``` +k3s etcd-snapshot \ + --s3 \ + --s3-bucket= \ + --s3-access-key= \ + --s3-secret-key= +``` + +To perform an on-demand etcd snapshot restore from S3, first make sure that K3s isn't running. Then run the following commands: + +``` +k3s server \ + --cluster-init \ + --cluster-reset \ + --etcd-s3 \ + --cluster-reset-restore-path= \ + --etcd-s3-bucket= \ + --etcd-s3-access-key= \ + --etcd-s3-secret-key= +```