Bird
0
0

Given this CronJob YAML snippet, what will happen?

medium📝 Command Output Q13 of 15
Kubernetes - Scheduling
Given this CronJob YAML snippet, what will happen?
apiVersion: batch/v1
kind: CronJob
metadata:
  name: hello-cron
spec:
  schedule: "*/5 * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: hello
            image: busybox
            command: ["echo", "Hello World"]
          restartPolicy: OnFailure
AThe job runs every 5 minutes but never prints anything.
BThe job runs once and never repeats.
CThe job runs every 5 minutes, printing "Hello World" once each time.
DThe job runs continuously without stopping.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the schedule field

    The schedule "*/5 * * * *" means run every 5 minutes.
  2. Step 2: Understand the jobTemplate behavior

    Each scheduled time creates a Job that runs the container once, printing "Hello World".
  3. Final Answer:

    The job runs every 5 minutes, printing "Hello World" once each time. -> Option C
  4. Quick Check:

    CronJob schedule "*/5 * * * *" = every 5 minutes [OK]
Quick Trick: CronJob schedule "*/5 * * * *" means every 5 minutes [OK]
Common Mistakes:
  • Thinking CronJob runs only once
  • Assuming continuous running container
  • Ignoring the command output

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes