CKA Workloads and Scheduling Practice Question
Which command creates a Job that runs a single pod to execute the command 'echo Hello'?
⚠ Common exam trap
Watch out — candidates often confuse `kubectl create job` with `kubectl run` or `kubectl create cronjob`, mistakenly thinking a one-time task can be created with a deployment or cronjob syntax, or that `kubectl run` supports a 'job' subcommand.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
kubectl create job hello --image=busybox -- echo Hello
`kubectl create job` is the dedicated command to create a Kubernetes Job object, which runs a pod to completion. The `--image=busybox` specifies the container image, and the `-- echo Hello` passes the command and its arguments to the container's entrypoint. This creates a non-repeating Job that executes the command once.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
kubectl create job hello --image=busybox -- echo Hello
Why this is correct
The `kubectl create job` command is the correct imperative way to create a Kubernetes Job object named `hello`. It uses the busybox image and passes `echo Hello` as the container's command, and since a Job's default completion count is 1, the Job controller schedules one Pod that runs to successful exit. This Job-managed Pod is automatically restarted or recreated if it fails, fulfilling the requirement of a single Pod execution to completion.
- ✗
kubectl create cronjob hello --image=busybox -- echo Hello
Why it's wrong here
This command invokes the CronJob resource type, which is fundamentally different from a Job: a CronJob is a scheduled workload that creates Jobs at specified times (for example, every five minutes). It requires a `--schedule` flag with a cron expression, and even then the Pod would only run on the next matching schedule, not immediately. Because the question asks for a one-time Job, creating a CronJob is incorrect.
- ✗
kubectl create deployment hello --image=busybox -- echo Hello
Why it's wrong here
A Deployment is designed for long-running, stateless application replicas, not for batch tasks that terminate. Although the command uses the same `--image` and argument syntax, it creates a Deployment with a ReplicaSet and a pod restart policy of `Always`, so the `echo Hello` container would continuously restart after each exit instead of being considered a completed, finished work item. A Job, by contrast, uses a restart policy of `Never` or `OnFailure` and stops once the backoff limit or completion condition is met.
- ✗
kubectl run job hello --image=busybox -- echo Hello
Why it's wrong here
The `kubectl run` command does not accept a resource type as an argument; `job` here becomes the name of a generated Pod (or Deployment, depending on flags and kubectl version), not a Job object. While a standalone Pod with `--restart=Never` might also run once, it lacks the Job controller's retry, backoff, and completion semantics, so it cannot ensure a completed execution the way a Job does. To create a Job, you must use the dedicated `kubectl create job` subcommand.
Go deeper
Related to this question
Learn chapter
Kubernetes Architecture Overview
Key term
kubectl Command Reference
kubectl is the command-line tool used to interact with and manage Kubernetes clusters by sending commands to the Kubernetes API.
Key term
Ingress Resources
Ingress Resources are Kubernetes API objects that manage external access to services inside a cluster, typically HTTP and HTTPS traffic, by defining rules for routing requests based on hostnames and paths.
About these practice questions
This CKA question is part of Courseiva's 302-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This CKA practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKA exam.