This challenge checks that you can, on your own, run a Job that processes a list of batches, schedule a recurring run with a CronJob and repair a Job that failed. It is meant for people who have just followed the lesson Kubernetes Jobs and CronJobs of the Make an application reliable module. It runs in a dsoxlab virtual machine, on a kubeadm cluster with Kubernetes 1.37, and takes about 40 minutes. It gives no hints and teaches nothing new: it checks what the lesson and its guided lab have already let you practice.
What you will learn
The grader reads the Jobs, their Pods and their logs, and the CronJob. It checks that you can:
- Process each batch of a list once, each Pod taking the batch of its own number, even when the number of batches changes.
- Limit a Job to two simultaneous Pods and a single retry.
- Schedule a CronJob with a required schedule, time zone, overlap rule, history and tolerated delay.
- Start a run of the CronJob by hand, without waiting for the schedule.
- Repair a failed Job, then recreate it so that it exports the expected period.
What should you be able to do before you start?
No step-by-step guide goes with the challenge, and choosing the right fields is part of what it checks. Everything it asks is taught in the lesson Kubernetes Jobs and CronJobs, whose guided lab ckad-job-cronjob lets you practice the parallel Job, the CronJob and its manual trigger.
The statement also has you read a configuration from a Pod: the lesson ConfigMaps teaches that step. If one of these points feels unclear, reread the lesson before you start.
What does the statement ask for?
The accounting department hands three jobs over to the cluster, in the compta namespace. You are connected to the control plane, with kubectl configured. The lots ConfigMap lists the invoice batches of the day, one lot-<index> key per batch starting with lot-0, and their number changes from one day to the next. The export-config ConfigMap holds the period to export. The export-compta Job failed last night. All the tasks use the image busybox:1.38.0@sha256:a46257e06c82ad85242d0d38077d0a52d9896389ca60a1a59d3463db586e5fa4.
The statement says what must be true at the end, never how to get there:
- A
facturer-lotsJob processes each batch once: as many completions as batches, each Pod takes the batch of its own number and writes to its logs a linelot <index> : <batch name>. The Job completes successfully. This requirement is blocking. facturer-lotsruns two Pods at a time and allows only one retry.- A
relance-impayesCronJob runs Monday to Friday at 6:15, Paris time. A run that starts replaces one that would still be running. It keeps three successful Jobs and two failed ones, and gives up a run that would be more than five minutes late. This requirement is blocking. - A run of
relance-impayes, started by hand without waiting for the schedule, has succeeded. export-comptahas been recreated and has succeeded: it exports the period thatexport-configholds.
Do not delete the Pods of the Jobs you have completed: their logs are used as evidence.
How do you start the challenge and get graded?
The lab prepares the cluster and draws at random the number of batches and their names, then reads the state of the cluster when you ask for your grade. You start it with dsoxlab run k8s-challenge-executer-et-planifier-des-taches. Then dsoxlab check k8s-challenge-executer-et-planifier-des-taches tells you where you stand, requirement by requirement, as many times as you like, and gives the grade. The grade never looks at the commands you typed: it reads the Jobs, their Pods, their logs and the CronJob.
Put it into practice
This lab is the challenge itself. It puts you in front of the situation described above and it is validated on the state of the cluster, as a colleague taking over your work would do.
How is the challenge graded?
The pass mark is 80%. Five criteria make up the grade: the Job that processes each batch by its own number, its two simultaneous Pods and its single retry, the schedule of the CronJob, the run started by hand, and the repaired Job. Requirements 1 and 3 are blocking: if either one is not met, the challenge fails, whatever the total.
If a criterion resists, reread the lesson Kubernetes Jobs and CronJobs, which teaches each of them, then run dsoxlab check again.
Key points
- The challenge is a final exercise to do alone and without hints: it explains nothing and grades the state of the cluster, not your commands.
- Requirements 1 and 3 are blocking: each batch processed once, and the schedule of the CronJob.
- The number of batches is drawn at random: read it in the
lotsConfigMap instead of assuming it. dsoxlab checkshows where you stand and gives the grade, as often as you like.