-
Notifications
You must be signed in to change notification settings - Fork 21
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
Delete snapshot that are already deleted from the cluster #719
Comments
After spending some time understanding the problem, here's my findings: Automatic snapshots by RKE2For any snapshots that RKE2 creates automatically, it retains the number of snapshots to the value set by the config and deletes any old snapshots automatically. For example, if the configuration is set as below, RKE2 will only maintain the 3 most recent snapshots. spec:
serverConfig:
etcd:
backupConfig:
scheduleCron: '*/5 * * * *'
retention: "3" Querying snapshots using root@rke2-control-plane-h7wns:/# rke2 etcd-snapshot ls
Name Location Size Created
etcd-snapshot-rke2-control-plane-h7wns-1738226104 file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-rke2-control-plane-h7wns-1738226104 14376992 2025-01-30T08:35:04Z
etcd-snapshot-rke2-control-plane-h7wns-1738226401 file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-rke2-control-plane-h7wns-1738226401 14376992 2025-01-30T08:40:01Z
etcd-snapshot-rke2-control-plane-h7wns-1738226703 file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-rke2-control-plane-h7wns-1738226703 14376992 2025-01-30T08:45:03Z Querying kubectl --kubeconfig rke2.kubeconfig get etcdsnapshotfiles.k3s.cattle.io -A
NAME SNAPSHOTNAME NODE LOCATION SIZE CREATIONTIME
local-etcd-snapshot-rke2-control-plane-h7wns-1738226104-6735e7 etcd-snapshot-rke2-control-plane-h7wns-1738226104 rke2-control-plane-h7wns file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-rke2-control-plane-h7wns-1738226104 14376992 2025-01-30T08:35:04Z
local-etcd-snapshot-rke2-control-plane-h7wns-1738226401-9c158b etcd-snapshot-rke2-control-plane-h7wns-1738226401 rke2-control-plane-h7wns file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-rke2-control-plane-h7wns-1738226401 14376992 2025-01-30T08:40:01Z
local-etcd-snapshot-rke2-control-plane-h7wns-1738226703-50cd20 etcd-snapshot-rke2-control-plane-h7wns-1738226703 rke2-control-plane-h7wns file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-rke2-control-plane-h7wns-1738226703 14376992 2025-01-30T08:45:03Z Querying kubectl get etcdmachinesnapshots.turtles-capi.cattle.io rke2 -o yaml
apiVersion: turtles-capi.cattle.io/v1alpha1
kind: ETCDMachineSnapshot
metadata:
annotations:
etcd.turtles.cattle.io/automatic-snapshot: "true"
creationTimestamp: "2025-01-29T16:39:00Z"
generation: 1
name: rke2
namespace: default
resourceVersion: "117893"
uid: f9375300-d07d-4fa1-aa19-f2dfdb352233
spec:
clusterName: rke2
status:
snapshots:
- creationTime: "2025-01-30T08:30:03Z"
location: file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-rke2-control-plane-h7wns-1738225803
machineName: rke2-control-plane-h7wns
name: local-etcd-snapshot-rke2-control-plane-h7wns-1738225803-e818b9
- creationTime: "2025-01-30T08:35:04Z"
location: file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-rke2-control-plane-h7wns-1738226104
machineName: rke2-control-plane-h7wns
name: local-etcd-snapshot-rke2-control-plane-h7wns-1738226104-6735e7
- creationTime: "2025-01-30T08:40:01Z"
location: file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-rke2-control-plane-h7wns-1738226401
machineName: rke2-control-plane-h7wns
name: local-etcd-snapshot-rke2-control-plane-h7wns-1738226401-9c158b So in this case the Manual snapshots via the
|
CAPRKE2 supports a retention policy for ETCD snapshots, which means it will keep only a certain number of snapshots(by default, 10) and remove any older ones. We need to make snapshot sync controller remove ETCDMachineSnapshots that don't exist anymore on cluster.
The text was updated successfully, but these errors were encountered: