K3s-cluster/vaultwarden/cronjob.yaml

26 lines
1000 B
YAML
Raw Normal View History

2022-09-10 01:44:23 +00:00
apiVersion: batch/v1
kind: CronJob
metadata:
name: backup-job
namespace: vaultwarden
spec:
schedule: "0 4 * * *" # Every day at 4AM
concurrencyPolicy: Forbid
jobTemplate:
spec:
template:
spec:
containers:
- name: maria-backup
image: mariadb
command: ["sh", "-c", "/usr/bin/mysqldump -h vaultwarden-svc.vaultwarden.svc.cluster.local -u root -pexample vaultwarden > /backup/vaultwarden/backup-$(date +'%H_%M-%d_%m_%Y').sql"]
volumeMounts:
- name: vaultwarden-backup
mountPath: /backup/vaultwarden
subPath: vaultwarden
volumes:
- name: vaultwarden-backup
persistentVolumeClaim:
claimName: vaultwarden-backup-pvc
restartPolicy: OnFailure