2019-05-11 20:16:37 +08:00
|
|
|
apiVersion: batch/v1beta1
|
|
|
|
kind: CronJob
|
|
|
|
metadata:
|
|
|
|
name: es-index-rotator
|
|
|
|
namespace: kube-system
|
|
|
|
spec:
|
|
|
|
# 每天1点3分执行
|
|
|
|
schedule: "3 1 */1 * *"
|
|
|
|
jobTemplate:
|
|
|
|
spec:
|
|
|
|
template:
|
|
|
|
spec:
|
|
|
|
containers:
|
|
|
|
- name: es-index-rotator
|
2020-01-09 23:35:17 +08:00
|
|
|
image: easzlab/es-index-rotator:0.2.1
|
|
|
|
# 保留最近10天日志
|
2019-05-11 20:16:37 +08:00
|
|
|
command:
|
|
|
|
- /bin/rotate.sh
|
2020-01-09 23:35:17 +08:00
|
|
|
- "10"
|
|
|
|
- "logstash" # fluented 默认创建的index形如'logstash-2020.01.01'
|
2019-05-11 20:16:37 +08:00
|
|
|
restartPolicy: OnFailure
|
|
|
|
concurrencyPolicy: Forbid
|
|
|
|
successfulJobsHistoryLimit: 2
|
|
|
|
failedJobsHistoryLimit: 1
|