Create Push Backups to Cloud Job

Create a file named push-backups.yaml with following content.

apiVersion: batch/v1
kind: Job
metadata:
  name: push-backups-${TIMESTAMP}
spec:
  backoffLimit: 1
  template:
    spec:
      securityContext:
        supplementalGroups: [1000]
      containers:
      - name: push-backups
        image: frappe/erpnext-worker:${VERSION}
        args: ["push-backup"]
        imagePullPolicy: IfNotPresent
        volumeMounts:
          - name: sites-dir
            mountPath: /home/frappe/frappe-bench/sites
        env:
          - name: "BUCKET_NAME"
            value: ${BUCKET_NAME}
          - name: "REGION"
            value: ${REGION}
          - name: "ACCESS_KEY_ID"
            valueFrom:
              secretKeyRef:
                key: accessKey
                name: push-backup-s3-secret
          - name: "SECRET_ACCESS_KEY"
            valueFrom:
              secretKeyRef:
                key: secretKey
                name: push-backup-s3-secret
          - name: "ENDPOINT_URL"
            value: "${ENDPOINT_URL}"
          - name: "BUCKET_DIR"
            value: "${BUCKET_DIR}"
      restartPolicy: Never
      volumes:
        - name: sites-dir
          persistentVolumeClaim:
            claimName: ${SITES_PVC}
            readOnly: false

Change the following properties:

Create the resource using:

$ kubectl create -n <namespace> -f push-backups.yaml