From the course: Certified Kubernetes Application Developer (CKAD) Cert Prep

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

CronJobs

CronJobs

- So, we have just learned about Jobs. Now, let's talk about CronJobs. What's the difference? Well, Jobs are used to run a task a specific number of times, and a CronJob adds schedule to a Job. And to add the schedule, Linux crontab syntax is used. So, if you have ever used crontab on Linux, scheduling a CronJob on Kubernetes will be easy. When you run a CronJob, a Job will be scheduled and this Job on its turn will start a Pod. And also nice to know, you can test a CronJob. In order to test a CronJob, you can use kubectl create job myjob --from=cronjob/mycronjob. That's a convenient command that might come in handy if you need to create a CronJob on the exam and you want to test that it's really working. Let's go check this out. So, let me use kubectl create cronjob -h | less once again, where you can see how it works. And this is the most useful command, because here, the first command really doesn't make sense. You start a busybox image, but you don't run any command. That doesn't…

Contents