← Back to all articles
KubernetesCKADPractice QuestionsCertification

CKAD Practice Questions: Jobs, CronJobs & Namespaces

15 February 2026·4 min read·By Jacob

Jobs and CronJobs appear in almost every CKAD sitting, and namespace-scoped commands trip up a lot of candidates who forget the -n flag. Let's drill these.


Question 1

What is the correct command to create a Job named backup-job using image busybox that runs the command tar -czf /backup.tar.gz /data?

  • A) kubectl create job backup-job --image=busybox -- tar -czf /backup.tar.gz /data
  • B) kubectl run backup-job --image=busybox --job -- tar -czf /backup.tar.gz /data
  • C) kubectl create pod backup-job --image=busybox --command tar -czf /backup.tar.gz /data
  • D) kubectl job backup-job --image=busybox --run 'tar -czf /backup.tar.gz /data'
<details> <summary>Show Answer & Explanation</summary>

Answer: A: kubectl create job backup-job --image=busybox -- tar -czf /backup.tar.gz /data

The -- separator tells kubectl that everything after it is the container command, not a kubectl flag. This is essential when the command contains flags (like -czf). Options B, C, and D are invalid syntax.

Jobs vs bare pods: A Job guarantees the container runs to completion and restarts the pod if it fails. A bare pod does not retry on failure.

# Create a job
kubectl create job backup-job --image=busybox -- tar -czf /backup.tar.gz /data

# Watch job status
kubectl get jobs
kubectl describe job backup-job

# View logs from the job's pod
kubectl logs -l job-name=backup-job

# Delete completed jobs automatically with TTL
# (set in the YAML: spec.ttlSecondsAfterFinished: 100)
</details>

Question 2

What is the correct command to create a CronJob named daily-backup that runs every day at 2 AM using image backup:latest?

  • A) kubectl create job daily-backup --cron='0 2 * * *' --image=backup:latest
  • B) kubectl cron daily-backup --schedule='0 2 * * *' --image=backup:latest
  • C) kubectl create schedule daily-backup --time='0 2 * * *' --image=backup:latest
  • D) kubectl create cronjob daily-backup --schedule='0 2 * * *' --image=backup:latest
<details> <summary>Show Answer & Explanation</summary>

Answer: D: kubectl create cronjob daily-backup --schedule='0 2 * * *' --image=backup:latest

kubectl create cronjob is the dedicated command. 0 2 * * * is standard cron syntax meaning "minute 0, hour 2, every day". Options A–C use incorrect subcommands or flags.

Cron schedule quick reference:

┌──── minute (0-59)
│  ┌─── hour (0-23)
│  │  ┌── day of month (1-31)
│  │  │  ┌─ month (1-12)
│  │  │  │ ┌ day of week (0-6, 0=Sunday)
│  │  │  │ │
0  2  *  *  *   →  every day at 02:00
*/15 * * * *    →  every 15 minutes
0 9 * * 1       →  every Monday at 09:00
0 0 1 * *       →  first day of every month at midnight

Trigger a CronJob manually:

kubectl create job --from=cronjob/daily-backup manual-run
</details>

Question 3

What is the correct command to edit a deployment named frontend in the production namespace?

  • A) kubectl modify deployment frontend --namespace=production
  • B) kubectl edit deployment frontend -n production
  • C) kubectl update deployment frontend -n production
  • D) kubectl change deployment frontend --namespace=production
<details> <summary>Show Answer & Explanation</summary>

Answer: B: kubectl edit deployment frontend -n production

kubectl edit opens the live resource manifest in your default editor ($KUBE_EDITOR or $EDITOR, usually vi). -n is the short form of --namespace. Options A, C, and D don't exist in kubectl.

Namespace tips for the exam:

# Short form -n is faster to type
kubectl get pods -n production

# Set a persistent namespace so you don't have to type -n every time
kubectl config set-context --current --namespace=production

# Verify which namespace you're currently in
kubectl config view --minify | grep namespace

# List resources across all namespaces
kubectl get pods --all-namespaces
kubectl get pods -A  # same thing, shorter

Setting the context namespace early in a task saves significant time, so you won't forget the -n flag and risk operating on the wrong namespace.

</details>

Key Takeaways

  • Use -- to separate kubectl flags from the container command in create job
  • CronJob syntax is kubectl create cronjob with --schedule='cron-expression'
  • -n is the short flag for --namespace; learn to type it fast
  • Set your context namespace with kubectl config set-context --current --namespace=<ns> to avoid mistakes

Ready to test your knowledge?

CKAD Practice Exams

Put what you've learned to the test with practice questions that mirror the real exam.

Start Practising →