-
Notifications
You must be signed in to change notification settings - Fork 67
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
Archive is Not Created #906
Comments
I test on my cluster with my k8up resources (I don't know exactly what your k8up resources are used for to generate an archive). However, when I didn't have any backup in my cluster, this problem occurred. No archive was created. P.S: Maybe your problem because of no backup files exist in s3 bucket Without any backup
With exist at least one backup
Could you please share more about backup and archive resources? |
Seems like the k8up errors out when the bucket is empty (and no restic repository is initialized). Here's a k8s job spec that can be used to initialize buckets as a workaround: apiVersion: batch/v1
kind: Job
metadata:
namespace: '<k8s_namespace>'
name: 'bucket-initialization'
spec:
backoffLimit: 3
template:
spec:
restartPolicy: Never
volumes:
- name: tmp
emptyDir: {}
initContainers:
- name: file-creation
image: busybox:1.28
command: ['sh', '-c', 'echo "$(date)" > /files/initialized.txt']
volumeMounts:
- mountPath: /files
name: tmp
containers:
- name: initialize-bucket
image: 'ubuntu:24.04'
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: /init-files
name: tmp
command: [ "/bin/bash", "-c" ]
args:
- |
set -ux; \
apt update; \
apt upgrade -y --no-install-recommends; \
apt install -y --no-install-recommends ca-certificates; \
update-ca-certificates; \
apt install -y --no-install-recommends wget; \
apt install -y --no-install-recommends jq; \
apt install -y --no-install-recommends restic;
wget "https://github.com/peak/s5cmd/releases/download/v2.2.2/s5cmd_2.2.2_Linux-arm64.tar.gz"
tar xzf s5cmd_2.2.2_Linux-arm64.tar.gz
mv s5cmd /usr/local/bin/.
s5cmd cp /init-files/initialized.txt s3://<bucket_name>/initialized.txt
# restic guards against initializing a repo that is already initialized so this can be run multiple times
restic init
# only keep 1 snapshot of a dummy backup to ensure a single backup exists in restic repo
restic forget $(restic snapshots --json --latest 1 --path "/init-files" | jq -r '.[0].id')
restic --verbose backup /init-files
envFrom:
- secretRef:
name: '<secret_that_contains_aws_access_key_id_and_aws_secret_key>'
env:
- name: 'S3_ENDPOINT_URL'
value: 'https://<domain>'
- name: RESTIC_REPOSITORY
value: "s3:https://<domain>/<bucket_name>"
- name: RESTIC_PASSWORD
valueFrom:
secretKeyRef:
name: "backup-cred"
key: "password"
|
Description
Archive created but empty
Additional Context
In #868 a bug fix for Archive was introduced.
Now tested looks like the archive isn't properly created. It exists on the cloud provider but it is empty after backup run.
Logs
Expected Behavior
Archive size > 0Bytes
Steps To Reproduce
archive created with schedule:
Archive could be run manually
Version of K8up
2.7.2
Version of Kubernetes
v1.26.9
Distribution of Kubernetes
OpenShift
The text was updated successfully, but these errors were encountered: