# apiVersion: batch/v1 # kind: CronJob # metadata: # name: postgres-backup-dev # namespace: default # spec: # schedule: "30 18 * * 5" # weekly Friday 18:30 # jobTemplate: # spec: # template: # spec: # restartPolicy: OnFailure # containers: # - name: backup # image: postgres:16 # command: # - /bin/sh # - -c # - | # pg_dump \ # -h postgres-dev.default.svc.cluster.local \ # -U $POSTGRES_USER \ # stripe_invoice \ # | gzip \ # | aws s3 cp - s3://$S3_BUCKET/dev/stripe_invoice/$(date +%F).sql.gz # envFrom: # - secretRef: # name: postgres-secret # DEV DB creds # - secretRef: # name: aws-backup-secret # shared AWS creds # --- # apiVersion: batch/v1 # kind: CronJob # metadata: # name: postgres-backup-prod # namespace: default # spec: # schedule: "30 01 * * *" # daily at 01:30 (recommended for prod) # jobTemplate: # spec: # template: # spec: # restartPolicy: OnFailure # containers: # - name: backup # image: postgres:16 # command: # - /bin/sh # - -c # - | # pg_dump \ # -h postgres-prod.default.svc.cluster.local \ # -U $POSTGRES_USER \ # stripe_invoice \ # | gzip \ # | aws s3 cp - s3://$S3_BUCKET/prod/stripe_invoice/$(date +%F).sql.gz # envFrom: # - secretRef: # name: postgres-prod-secret # PROD DB creds # - secretRef: # name: aws-backup-secret # shared AWS creds