Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Release-1.27] - Snapshot retention does not work with etcd-s3-folder #10313

Closed
vitorsavian opened this issue Jun 6, 2024 · 1 comment
Closed
Assignees
Milestone

Comments

@vitorsavian
Copy link
Member

Backport fix for Snapshot retention does not work with etcd-s3-folder

@aganesh-suse
Copy link

Validated on release-1.27 branch with version v1.27.15-rc3+k3s1

Environment Details

Infrastructure

  • Cloud
  • Hosted

Node(s) CPU architecture, OS, and Version:

$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.2 LTS"

$ uname -m
x86_64

Cluster Configuration:

HA: 3 server/ 1 agent

Config.yaml:

token: xxxx
cluster-init: true
write-kubeconfig-mode: "0644"
node-external-ip: 1.1.1.1
node-label:
- k3s-upgrade=server

etcd-snapshot-retention: 2
etcd-snapshot-schedule-cron: "* * * * *"
etcd-s3: true
etcd-s3-access-key: <access-key>
etcd-s3-secret-key: <secret-key>
etcd-s3-bucket: <s3-bucket>
etcd-s3-folder: <s3-folder>
etcd-s3-region: <region>

debug: true

Testing Steps

  1. Copy config.yaml
$ sudo mkdir -p /etc/rancher/k3s && sudo cp config.yaml /etc/rancher/k3s
  1. Install k3s
curl -sfL https://get.k3s.io | sudo INSTALL_K3S_VERSION='v1.27.15-rc3+k3s1' sh -s - server
  1. Verify Cluster Status:
kubectl get nodes -o wide
kubectl get pods -A
  1. Perform:
$ sudo k3s etcd-snapshot prune
$ sudo k3s etcd-snapshot list 

pruned snapshot should not be listed after being deleted.

Replication Results:

  • k3s version used for replication:
$ k3s -v
k3s version v1.27.14+k3s1 (b0b34e4d)
go version go1.21.9
 $ sudo /usr/local/bin/k3s etcd-snapshot prune 
time="2024-06-21T18:27:45Z" level=warning msg="Unknown flag --etcd-snapshot-schedule-cron found in config.yaml, skipping\n"
time="2024-06-21T18:27:45Z" level=warning msg="Unknown flag --cluster-init found in config.yaml, skipping\n"
time="2024-06-21T18:27:45Z" level=warning msg="Unknown flag --write-kubeconfig-mode found in config.yaml, skipping\n"
time="2024-06-21T18:27:45Z" level=warning msg="Unknown flag --node-external-ip found in config.yaml, skipping\n"
time="2024-06-21T18:27:45Z" level=warning msg="Unknown flag --node-label found in config.yaml, skipping\n"
time="2024-06-21T18:27:45Z" level=warning msg="Cluster CA certificate is not trusted by the host CA bundle, but the token does not include a CA hash. Use the full token from the server's node-token file to enable Cluster CA validation."
time="2024-06-21T18:27:46Z" level=info msg="Snapshot on-demand-ip-172-31-30-182-1718994392 deleted."
time="2024-06-21T18:27:46Z" level=info msg="Snapshot <s3-folder>/on-demand-ip-172-31-30-182-1718994392 deleted."
 $ sudo /usr/local/bin/k3s etcd-snapshot list 2>/dev/null On SERVER1: 18.188.91.198
Name                                      Location                                                                                         Size    Created
etcd-snapshot-ip-172-31-30-182-1718994001 s3://<s3-bucket>/<s3-folder>/etcd-snapshot-ip-172-31-30-182-1718994001 770080  2024-06-21T18:20:01Z
etcd-snapshot-ip-172-31-30-182-1718994062 s3://<s3-bucket>/<s3-folder>/etcd-snapshot-ip-172-31-30-182-1718994062 3358752 2024-06-21T18:21:02Z
etcd-snapshot-ip-172-31-30-182-1718994125 s3://<s3-bucket>/<s3-folder>/etcd-snapshot-ip-172-31-30-182-1718994125 3813408 2024-06-21T18:22:05Z
etcd-snapshot-ip-172-31-30-182-1718994181 s3://<s3-bucket>/<s3-folder>/etcd-snapshot-ip-172-31-30-182-1718994181 4214816 2024-06-21T18:23:01Z
etcd-snapshot-ip-172-31-30-182-1718994242 s3://<s3-bucket>/<s3-folder>/etcd-snapshot-ip-172-31-30-182-1718994242 4423712 2024-06-21T18:24:02Z
etcd-snapshot-ip-172-31-30-182-1718994302 s3://<s3-bucket>/<s3-folder>/etcd-snapshot-ip-172-31-30-182-1718994302 5296160 2024-06-21T18:25:02Z
etcd-snapshot-ip-172-31-30-182-1718994363 s3://<s3-bucket>/<s3-folder>/etcd-snapshot-ip-172-31-30-182-1718994363 5521440 2024-06-21T18:26:03Z
etcd-snapshot-ip-172-31-30-182-1718994363 file:///var/lib/rancher/k3s/server/db/snapshots/etcd-snapshot-ip-172-31-30-182-1718994363        5521440 2024-06-21T18:26:03Z
on-demand-ip-172-31-30-182-1718994392     s3://<s3-bucket>/<s3-folder>/on-demand-ip-172-31-30-182-1718994392     5619744 2024-06-21T18:26:32Z
on-demand-ip-172-31-30-182-1718994399     s3://<s3-bucket>/<s3-folder>/on-demand-ip-172-31-30-182-1718994399     5664800 2024-06-21T18:26:39Z
on-demand-ip-172-31-30-182-1718994399     file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-30-182-1718994399            5664800 2024-06-21T18:26:39Z
on-demand-ip-172-31-30-182-1718994408     s3://<s3-bucket>/<s3-folder>/on-demand-ip-172-31-30-182-1718994408     5713952 2024-06-21T18:26:48Z
on-demand-ip-172-31-30-182-1718994408     file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-30-182-1718994408            5713952 2024-06-21T18:26:48Z
etcd-snapshot-ip-172-31-30-182-1718994421 s3://<s3-bucket>/<s3-folder>/etcd-snapshot-ip-172-31-30-182-1718994421 5791776 2024-06-21T18:27:01Z
etcd-snapshot-ip-172-31-30-182-1718994421 file:///var/lib/rancher/k3s/server/db/snapshots/etcd-snapshot-ip-172-31-30-182-1718994421        5791776 2024-06-21T18:27:01Z

on-demand-ip-172-31-30-182-1718994392 is still listed above - after it was supposed to be deleted.

Validation Results:

  • k3s version used for validation:
$ k3s -v
k3s version v1.27.15-rc3+k3s1 (3ced503a)
go version go1.21.11
 $ sudo /usr/local/bin/k3s etcd-snapshot prune 
time="2024-06-21T18:27:37Z" level=warning msg="Unknown flag --etcd-snapshot-schedule-cron found in config.yaml, skipping\n"
time="2024-06-21T18:27:37Z" level=warning msg="Unknown flag --cluster-init found in config.yaml, skipping\n"
time="2024-06-21T18:27:37Z" level=warning msg="Unknown flag --write-kubeconfig-mode found in config.yaml, skipping\n"
time="2024-06-21T18:27:37Z" level=warning msg="Unknown flag --node-external-ip found in config.yaml, skipping\n"
time="2024-06-21T18:27:37Z" level=warning msg="Unknown flag --node-label found in config.yaml, skipping\n"
time="2024-06-21T18:27:37Z" level=warning msg="Cluster CA certificate is not trusted by the host CA bundle, but the token does not include a CA hash. Use the full token from the server's node-token file to enable Cluster CA validation."
time="2024-06-21T18:27:38Z" level=info msg="Snapshot on-demand-ip-172-31-21-205-1718994386 deleted."
time="2024-06-21T18:27:38Z" level=info msg="Snapshot on-demand-ip-172-31-21-205-1718994386 deleted."

$ sudo /usr/local/bin/k3s etcd-snapshot list
Name                                      Location                                                                                            Size    Created
etcd-snapshot-ip-172-31-21-205-1718994364 s3://<s3-bucket>/<s3-folder>/etcd-snapshot-ip-172-31-21-205-1718994364 5492768 2024-06-21T18:26:04Z
etcd-snapshot-ip-172-31-21-205-1718994364 file:///var/lib/rancher/k3s/server/db/snapshots/etcd-snapshot-ip-172-31-21-205-1718994364           5492768 2024-06-21T18:26:04Z
on-demand-ip-172-31-21-205-1718994394     s3://<s3-bucket>/<s3-folder>/on-demand-ip-172-31-21-205-1718994394     5627936 2024-06-21T18:26:34Z
on-demand-ip-172-31-21-205-1718994394     file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-21-205-1718994394               5627936 2024-06-21T18:26:34Z
on-demand-ip-172-31-21-205-1718994402     s3://<s3-bucket>/<s3-folder>/on-demand-ip-172-31-21-205-1718994402     5697568 2024-06-21T18:26:42Z
on-demand-ip-172-31-21-205-1718994402     file:///var/lib/rancher/k3s/server/db/snapshots/on-demand-ip-172-31-21-205-1718994402               5697568 2024-06-21T18:26:42Z
etcd-snapshot-ip-172-31-21-205-1718994422 s3://<s3-bucket>/<s3-folder>/etcd-snapshot-ip-172-31-21-205-1718994422 5763104 2024-06-21T18:27:02Z
etcd-snapshot-ip-172-31-21-205-1718994422 file:///var/lib/rancher/k3s/server/db/snapshots/etcd-snapshot-ip-172-31-21-205-1718994422           5763104 2024-06-21T18:27:02Z

on-demand-ip-172-31-21-205-1718994386 is not on the list post delete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

4 participants