apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: kube-state-backup
  namespace: kube-system
  labels:
    app: kube-backup
spec:
  schedule: "*/10 * * * *"
  concurrencyPolicy: Replace
  successfulJobsHistoryLimit: 3
  failedJobsHistoryLimit: 3
  jobTemplate:
    spec:
      template:
        metadata:
          labels:
            app: kube-backup
          name: kube-backup
        spec:
          containers:
          - image: zeusro/kube-backup:1.12.0-1
            imagePullPolicy: Always
            name: backup
            resources: {}
            # securityContext:
            #   runAsUser: 1000
            env:
            - name: GIT_REPO
              value: "git@git.example.com:infra/kube-backup.git"
            volumeMounts:
            - mountPath: /root/
              name: cache
            - mountPath: /root/.ssh
              name: sshkey
          dnsPolicy: ClusterFirst
          terminationGracePeriodSeconds: 30
          serviceAccountName: kube-backup
          volumes:
          - name: sshkey
            secret:
              defaultMode: 256
              secretName: kube-backup-ssh
          - name: cache
            emptyDir: {}
          restartPolicy: OnFailure
