How to Create a Schedule
The Schedule
object defines the frequency, destination and secrets required to run K8up jobs in your namespace:
apiVersion: k8up.io/v1
kind: Schedule
metadata:
name: schedule-test
spec:
backend:
s3:
endpoint: http://minio:9000
bucket: backups
accessKeyIDSecretRef:
name: minio-credentials
key: username
secretAccessKeySecretRef:
name: minio-credentials
key: password
repoPasswordSecretRef:
name: backup-repo
key: password
backup:
schedule: '*/5 * * * *'
failedJobsHistoryLimit: 2
successfulJobsHistoryLimit: 2
# optional
#promURL: https://prometheus-io-instance:8443
check:
schedule: '0 1 * * 1'
# optional
#promURL: https://prometheus-io-instance:8443
prune:
schedule: '0 1 * * 0'
retention:
keepLast: 5
keepDaily: 14
Save the YAML above in a file named schedule.yaml
and use the kubectl apply -f schedule.yaml
command to deploy this configuration to your cluster.
The file above will instruct the Operator to do backups every 5 minute, prune them monthly and run check jobs for repository maintenance. It will also archive the latest snapshots to the archive
bucket once each week.
Feel free to adjust the frequencies to your liking. To help you with the crontab syntax, we recommend to check out crontab.guru.
You can always check the state and configuration of your backup by using kubectl describe schedule . By default, all PVCs are backed up automatically. Adding the annotation k8up.io/backup=false to a PVC object will excluded it from all following backup.
|