k43D/postgres_backup/job.yml

41 lines
1004 B
YAML
Raw Permalink Normal View History

2023-09-17 09:10:08 +00:00
apiVersion: batch/v1
kind: Job
metadata:
name: postgres-backup
2023-09-17 09:10:08 +00:00
spec:
template:
spec:
containers:
- name: postgres-backup
image: postgres:15-alpine
2023-09-17 09:10:08 +00:00
command: [ "/bin/sh" ]
args: [ "-c", "sleep 3600" ]
env:
- name: PG_HOST
value: postgres-postgresql
- name: PG_USER
value: backup
- name: PGPASSWORD
2023-09-17 09:10:08 +00:00
valueFrom:
secretKeyRef:
name: backupscrets
key: pgbackupsecret
2023-09-17 09:10:08 +00:00
volumeMounts:
- name: backup-volume
mountPath: /backup
subPath: postgres
2023-09-17 09:10:08 +00:00
- name: backup-script
mountPath: /backup-script.sh
subPath: backup-script.sh
readOnly: true
restartPolicy: OnFailure
volumes:
- name: backup-volume
nfs:
server: 192.168.86.86
path: /volume1/backupk8s
- name: backup-script
configMap:
name: postgres-backup-script
2023-09-17 09:10:08 +00:00
backoffLimit: 1