typora/note/K8S/实战笔记/cron.md
2024-12-12 10:48:55 +08:00

747 B

定时任务

apiVersion: batch/v1
kind: CronJob
metadata:
  name: sync-guess-content-to-db
  namespace: cron
spec:
  schedule: "30 9 * * *"
  jobTemplate:
    spec:
      template:
        spec:
          restartPolicy: Never
          containers:
          - name: sync-guess-content-to-db
            image: busybox:1.36
            imagePullPolicy: IfNotPresent
            command: ["/bin/sh"]
            args:
            - -c
            - "/data/nd-feedback-offline-go -i /data/config.yaml -c SyncGuessContent2DB"
            volumeMounts:
            - name: data
              mountPath: /data
          volumes:
          - name: data
            hostPath:
              path: /root/cron
              type: Directory