Add a sample backup cronjob
This commit is contained in:
parent
027ec6ceeb
commit
fc7707aff2
1 changed files with 29 additions and 0 deletions
29
generic/rsync-backup-cronjob.yaml
Normal file
29
generic/rsync-backup-cronjob.yaml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: CronJob
|
||||||
|
metadata:
|
||||||
|
name:
|
||||||
|
backup-test
|
||||||
|
spec:
|
||||||
|
schedule: "* * * * *"
|
||||||
|
jobTemplate:
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: backup
|
||||||
|
image: instrumentisto/rsync-ssh:alpine3.16
|
||||||
|
args:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- "rsync -a /etc/ /mnt/etc-dir/$(date +%a%H%M)"
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /mnt
|
||||||
|
name: backup
|
||||||
|
restartPolicy: Never
|
||||||
|
nodeSelector:
|
||||||
|
kubernetes.io/hostname: "server101"
|
||||||
|
volumes:
|
||||||
|
- name: backup
|
||||||
|
hostPath:
|
||||||
|
path: /mnt
|
||||||
|
type: Directory
|
Loading…
Reference in a new issue