Add vaultwarden backup strategy
This commit is contained in:
parent
741721b389
commit
38da63153d
25
vaultwarden/cronjob.yaml
Normal file
25
vaultwarden/cronjob.yaml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
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
|
@ -13,6 +13,8 @@ spec:
|
|||||||
labels:
|
labels:
|
||||||
app: vaultwarden
|
app: vaultwarden
|
||||||
spec:
|
spec:
|
||||||
|
hostname: vaultwarden
|
||||||
|
subdomain: vaultwarden
|
||||||
containers:
|
containers:
|
||||||
- name: vaultwarden
|
- name: vaultwarden
|
||||||
image: vaultwarden/server
|
image: vaultwarden/server
|
||||||
|
12
vaultwarden/pvc.yaml
Normal file
12
vaultwarden/pvc.yaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: vaultwarden-backup-pvc
|
||||||
|
namespace: vaultwarden
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 1Gi
|
||||||
|
storageClassName: flat-storage-class
|
@ -9,5 +9,9 @@ spec:
|
|||||||
port: 80
|
port: 80
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
targetPort: 80
|
targetPort: 80
|
||||||
|
- name: db
|
||||||
|
port: 3306
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 3306
|
||||||
selector:
|
selector:
|
||||||
app: vaultwarden
|
app: vaultwarden
|
||||||
|
Loading…
Reference in New Issue
Block a user