
cronjob을 사용1 2 3 4 5 6 7 8 9 10 11 12 13 | apiVersion: batch/v1 kind: Job metadata: name: pi spec: template: spec: containers: - name: pi image: perl:5.34.0 command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"] restartPolicy: Never backoffLimit: 4 | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | apiVersion: batch/v1 kind: CronJob metadata: name: hello spec: schedule: "* * * * *" jobTemplate: spec: template: spec: containers: - name: hello image: busybox:1.28 command: - /bin/sh - -c - date; echo Hello from the Kubernetes cluster restartPolicy: OnFailure | cs |
.spec.completions : 몇개의 job이 complete되어야 완료된 것인지 정의 .spec.parallelism : 최초에 병렬적으로 생성할 job의 개수.spec.backoffLimit : job의 작업이 실패할 경우에 재시도할 횟수 .spec.activeDeadlineSeconds : job이 시작된 후 작동 가능한 유효 시간.spec.template.spec.restartPolicy : 에러 발생 시 재시작 옵션Always : 항상 재시작OnFailure : 장애 발생 시 재시작Never : 재시작하지 않음