BM: Baca dalam Bahasa Melayu
World K2: Trays & Orders
Jobs and CronJobs
You will learn: to run a task once with a Job, and on a schedule with a CronJob.
Checked with Kubernetes 1.37 on 31 Oct 2026
The problem
After closing, someone counts the plates once, then goes home. You make that counter a Deployment. What happens?
Pick one answer.
Watch
kind-dev namespace defaultA Job: A task that runs until it finishes, like counting the plates once. runs a task until it finishes, then stops. STATUS says Complete. COMPLETIONS says 1/1.
Predict
The Job’s pod finished well. What does kubectl get pods show for it?
Pick one answer.
Try it
A Job may not use restartPolicy: Always. Read the real error. Pick one of the values it lists.
Fix the manifest, then press Apply.
Watch
A CronJob: Makes a Job on a schedule, like counting the plates every night. makes a Job on a schedule. Its five fields are minute, hour, day, month and weekday.
spec:
schedule: "30 23 * * *"When does this run?
Pick one answer.
Try it
Do not wait for tonight. Apply nightly.yaml. Then start one count now: kubectl create job tally-now --from=cronjob/nightly.
kind-dev namespace defaultdev-control-planeOpenManagerNo trays here.
dev-workerOpenNo trays here.
dev-worker2OpenNo trays here.
Hint
--from=cronjob/nightly copies the CronJob’s job template.Check
Deployment, Job or CronJob? Sort each task.
Drag a card into a box. Or tap the card, then tap the box.
You did it!
You can now run a task once, or on a schedule.
Go deeper (optional)
A failing Job retries, up to backoffLimit times (6 by default). Without timeZone, a CronJob follows the cluster’s clock, often UTC. A CronJob keeps the last 3 good Jobs and removes older ones.
Real rep (optional): on a throwaway cluster, run kubectl get cronjobs and kubectl get jobs.
Bahasa Melayu
Selepas tutup kedai, seseorang kira pinggan sekali, kemudian balik. Anda jadikan pengira itu Deployment. Apa jadi?
Job jalankan tugas sehingga siap, kemudian berhenti. STATUS tunjuk Complete. COMPLETIONS tunjuk 1/1.
Pod Job itu siap dengan baik. Apa kubectl get pods tunjuk untuknya?
Job tak boleh guna restartPolicy: Always. Baca ralat sebenar. Pilih salah satu nilai yang ia senaraikan.
CronJob buat Job ikut jadual. Lima medannya ialah minit, jam, hari, bulan dan hari dalam minggu.
spec:
schedule: "30 23 * * *"Bila ia berjalan?
Tak perlu tunggu malam ini. Apply nightly.yaml. Kemudian mulakan satu kiraan sekarang: kubectl create job tally-now --from=cronjob/nightly.
--from=cronjob/nightly salin templat job daripada CronJob itu.Deployment, Job atau CronJob? Susun setiap tugas.
Kini anda boleh jalankan tugas sekali, atau ikut jadual.
You finished this before. Practice is always welcome!
Official docs: Kubernetes: Jobs · Kubernetes: CronJob · kubectl create job
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?