---
apiVersion: batch/v1
kind: CronJob
metadata:
  name: redis-wfm-bak
  namespace: wfm
spec:
  concurrencyPolicy: Allow
  failedJobsHistoryLimit: 1
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - args:
                - >
                  #!/bin/bash

                  today=$(date +%F)

                  redis-dump -u redis-0-nodeport:6379 -d 0 -a K4l2kC8Y0Nsep7eS
                  >/redis-wfm-bak/redis-wfm-bak-$today.json
              command:
                - /bin/bash
                - '-c'
              image: registry.cn-hangzhou.aliyuncs.com/zhengyu1992/redisdump
              imagePullPolicy: IfNotPresent
              name: redis-wfm-bak
              resources: {}
              terminationMessagePath: /dev/termination-log
              terminationMessagePolicy: File
              volumeMounts:
                - mountPath: /redis-wfm-bak
                  name: redis-wfm-backup-volume
          dnsPolicy: ClusterFirst
          restartPolicy: OnFailure
          schedulerName: default-scheduler
          securityContext: {}
          terminationGracePeriodSeconds: 30
          volumes:
            - name: redis-wfm-backup-volume
              nfs:
                path: /data/nfs/redis-wfm-bak
                server: d1-nfs001
  schedule: 00 18 * * *
  successfulJobsHistoryLimit: 1
  suspend: false
  • No labels