26 lines
1000 B
YAML
26 lines
1000 B
YAML
|
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
|