# Guided Exercise: Choosing the Right Workload Primitive Paper-and-thinking exercise before the Labs. ## The scenario Your team needs four things running in the cluster: 1. A nightly database backup that must run at 2am and finish before morning. 2. A log-shipping agent that must run on every node, including nodes added later. 3. A one-time script to backfill a new database column, run once during this deploy. 4. The main web application, always up, serving live traffic. ## Your task For each of the four, name the correct primitive (Deployment, Job, CronJob, or DaemonSet) and answer: what would go wrong if you used a Deployment for it instead? ## A worked answer to check yourself against 1. **CronJob.** A Deployment has no concept of "run on a schedule" — you'd need external tooling to trigger it repeatedly, reinventing what CronJob already does. Using a bare Job would run it once; CronJob is what recreates that Job on schedule. 2. **DaemonSet.** A Deployment's replica count is a number, not "one per node" — nothing guarantees even coverage, and a newly added node wouldn't automatically get a copy the way a DaemonSet guarantees. 3. **Job.** A Deployment expects its Pod to run forever; a script that's SUPPOSED to exit when done would be treated as a crash and restarted forever, which is wrong for a one-time task. 4. **Deployment.** This is the actual always-on, N-replicas case the other three are explicitly NOT designed for. ## Self-check If you answered "Job" for #4 or "Deployment" for #1-3, revisit the lesson's decision table before the Labs — getting this choice right the first time avoids building something that technically runs but behaves wrong in a way that's easy to miss until it causes a real problem (a backup CronJob accidentally deployed as a Job that only ever runs once, for example). ## Instructor Notes **Facilitation:** Good as a quick individual exercise before revealing the answer — the "what would go wrong" framing forces reasoning about the CONSEQUENCE of a wrong choice, not just recall of a definition. **Approximate timing:** 8-10 minutes live with discussion; 8 minutes self-paced. **Optional extension:** ask what would need to be true for #1 (the nightly backup) to actually be SAFE to run as a plain Job triggered manually once, instead of a CronJob — a good check that students understand CronJob's value is specifically the SCHEDULING, not something inherent to backups.