41 lines
1004 B
YAML
41 lines
1004 B
YAML
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: postgres-backup
|
|
spec:
|
|
template:
|
|
spec:
|
|
containers:
|
|
- name: postgres-backup
|
|
image: postgres:15-alpine
|
|
command: [ "/bin/sh" ]
|
|
args: [ "-c", "sleep 3600" ]
|
|
env:
|
|
- name: PG_HOST
|
|
value: postgres-postgresql
|
|
- name: PG_USER
|
|
value: backup
|
|
- name: PGPASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: backupscrets
|
|
key: pgbackupsecret
|
|
volumeMounts:
|
|
- name: backup-volume
|
|
mountPath: /backup
|
|
subPath: postgres
|
|
- 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
|
|
backoffLimit: 1
|