k43D/mysqlbackup/cronjob.yml
2023-06-05 21:59:03 +02:00

40 lines
1.1 KiB
YAML

apiVersion: batch/v1
kind: CronJob
metadata:
name: mysql-backup
spec:
schedule: "0 0 * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: mysql-backup
image: mariadb:latest
command: ["sh", "/backup-script.sh"]
env:
- name: MYSQL_HOST
value: galera-mariadb-galera
- name: MYSQL_USER
value: backupuser
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: backupscrets
key: backupsecret
volumeMounts:
- name: backup-volume
mountPath: /backup
- name: backup-script
mountPath: /backup-script.sh
subPath: backup-script.sh
readOnly: true
restartPolicy: OnFailure
volumes:
- name: backup-volume
persistentVolumeClaim:
claimName: nfs-mysqlbacup-claim
- name: backup-script
configMap:
name: backup-script