added backups cronjob
This commit is contained in:
parent
a75ab8b615
commit
664c1e42b7
2 changed files with 134 additions and 0 deletions
80
alaskarTV/backups/cronjobs.yaml
Normal file
80
alaskarTV/backups/cronjobs.yaml
Normal file
|
@ -0,0 +1,80 @@
|
|||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: backups-nfs
|
||||
spec:
|
||||
schedule: "0 2 * * *" # Runs daily at 2 AM
|
||||
jobTemplate:
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: nfs-backup
|
||||
image: alpine:3.18
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
# Backup /SSD/configs/ to backups/alaskartv
|
||||
rsync -av --delete /configs/ /backups/alaskartv/
|
||||
|
||||
# Backup Forgejo instance and DB
|
||||
rsync -av --delete /git/forgejo-instance/ /backups/git/forgejo-instance/
|
||||
rsync -av --delete /git/forgejo-db/ /backups/git/forgejo-db/
|
||||
volumeMounts:
|
||||
- name: nfs-configs
|
||||
mountPath: /configs
|
||||
- name: nfs-git
|
||||
mountPath: /git
|
||||
- name: nfs-backups
|
||||
mountPath: /backups
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
runAsGroup: 0
|
||||
privileged: true
|
||||
restartPolicy: OnFailure
|
||||
volumes:
|
||||
- name: nfs-configs
|
||||
persistentVolumeClaim:
|
||||
claimName: pvc-nfs-configs
|
||||
- name: nfs-git
|
||||
persistentVolumeClaim:
|
||||
claimName: pvc-nfs-git
|
||||
- name: nfs-backups
|
||||
persistentVolumeClaim:
|
||||
claimName: pvc-nfs-backups
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: pvc-nfs-configs
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 3Ti
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: pvc-nfs-git
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 3Ti
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: pvc-nfs-backups
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 3Ti
|
54
alaskarTV/backups/pv.yaml
Normal file
54
alaskarTV/backups/pv.yaml
Normal file
|
@ -0,0 +1,54 @@
|
|||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: nfs-ssd-configs
|
||||
spec:
|
||||
capacity:
|
||||
storage: 3Ti
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
csi:
|
||||
driver: nfs.csi.k8s.io
|
||||
volumeHandle: nfs-ssd
|
||||
volumeAttributes:
|
||||
server: 192.168.0.200
|
||||
share: /SSD/media/configs
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: nfs-nas-git
|
||||
spec:
|
||||
capacity:
|
||||
storage: 3Ti
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
csi:
|
||||
driver: nfs.csi.k8s.io
|
||||
volumeHandle: nfs-nas-git
|
||||
volumeAttributes:
|
||||
server: 192.168.0.100
|
||||
share: /ssd/git
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: nfs-nas-git
|
||||
spec:
|
||||
capacity:
|
||||
storage: 3Ti
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
csi:
|
||||
driver: nfs.csi.k8s.io
|
||||
volumeHandle: nfs-nas-git
|
||||
volumeAttributes:
|
||||
server: 192.168.0.100
|
||||
share: /ssd/backups
|
||||
|
||||
|
Loading…
Reference in a new issue