Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the cronJob in K8s

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "what is cronJob in K8s". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what is cronJob in K8s"?

I. cronJob

1. Doc

Https://kubernetes.io/zh/docs/concepts/workloads/controllers/cron-jobs/#%E5%89%8D%E6%8F%90%E6%9D%A1%E4%BB%B6

two。 Parameter in-depth understanding

1) startingDeadlineSeconds, read the document.

2) concurrencyPolicy

Allow (default): allows Job to run concurrently, that is, job misses the execution time (it may be container crashoff, job supend, or others). When cronJob is started again, the job of miss is calculated according to schedule and executed in parallel with the current job.

Forbid: if old job is running, skip the new job and will not create a new job... If you use kubectl get jobs-n namespace to view the jobs under this cronJob, you will find that as long as old job runs, no new job will be created, no matter how many times schedule misses

Replace: if an old Job is running when a new Job is created, CronJob controller replaces the old Job with the new Job

3) failedJobsHistoryLimit: 0

SuccessfulJobsHistoryLimit: 3

The number of failed or successful job saved in cronjob

Note: successfulJobsHistoryLimit saves the number of job for completed and running

two。 Job parameter

When a Job completes, no more Pods are created, but the Pods are not deleted either

Terminal or clean up job

1. Kubectl deletes job and deletes all pod created by it

2. If the restartPolicy of backoffLimit pod or container is not never, when the number of restarts reaches the threshold value, job is marked as failed, and all running pod will be terminated.

3. ActiveDeadlineSeconds when the running time of a job reaches activeDeadlineSeconds, all running pod will be terminated, and the job faild, because DeadlineExceeded.

Note:

This parameter can specify the running period of job, and the job and the pod created by it will be cleaned and the system resources will be removed, but the scheduling information of cronjob will also be cleared at the same time, as shown in the figure below. Last schedule, age and schedule are not matched.

ActiveDeadlineSeconds takes precedence over backoffLimit

4.

TtlSecondsAfterFinished: 100

TTLAfterFinished needs to be enabled. K8s is disabled by default.

At this point, I believe you have a deeper understanding of "what is cronJob in K8s". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report