Schedule a CronJob and Run It Now

medium 20 XP ~8 minHands-on lab

The label-printer team in checkout wants its nightly purge to run on Kubernetes instead of an old crontab. They also want one run right now, to see it work before the first scheduled night.

Task

  • Create a CronJob label-printer-purge in checkout with the schedule 30 2 * * *.
  • Its container uses the image busybox:1.36 and runs the command echo purge-meadow.
  • A new run never starts while the previous one is still running (concurrencyPolicy: Forbid).
  • It keeps the last 2 successful and the last 3 failed Jobs.
  • A run that could not start on time may still start up to 300 seconds late, and not later.
  • Trigger one run now: a Job label-printer-purge-meadow in checkout, created from the CronJob label-printer-purge, that completes.
  • Leave the CronJob label-printer-digest as it is.

A practice cluster is running on this machine: start with kubectl get cronjobs,jobs -n checkout.

About this machine

Ubuntu 24.04 with a private practice cluster: a real Kubernetes API server, scheduler and controllers, and three nodes (controlplane, node01, node02). Containers are simulated, so images never download and kubectl logs/exec are not available. k is an alias for kubectl, with completion. The grader checks the cluster's final state, not the commands you typed.

TerminalNot started

Your machine is ready to start

Create a free account to open a machine and get graded.