apiVersion: batch/v1 kind: CronJob metadata: name: postgres-backup spec: schedule: "30 18 * * 5" # weekly on friday at 18:30 jobTemplate: spec: template: spec: restartPolicy: OnFailure containers: - name: backup image: postgres:16 command: - /bin/sh - -c - | pg_dump stripe_xero \ | gzip \ | aws s3 cp - s3://$S3_BUCKET/stripe_xero/$(date +%F).sql.gz envFrom: - secretRef: name: postgres-secret - secretRef: name: aws-backup-secret