typora/note/K8S/实战笔记/cron.md

34 lines
747 B
Markdown
Raw Permalink Normal View History

2024-12-11 21:48:55 -05:00
### 定时任务
```yaml
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
```