KCNA Container Orchestration Practice Question
Which command correctly creates a Deployment named 'web-app' with the image 'nginx:1.21' and 3 replicas?
⚠ Common exam trap
CNCF often tests the distinction between `kubectl run` (which creates a Pod, not a Deployment) and `kubectl create deployment` (which creates a Deployment with replica management), leading candidates to mistakenly choose `kubectl run` when replicas are required.
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 deployment web-app --image=nginx:1.21 --replicas=3
`kubectl create deployment` is the imperative command specifically designed to create a Deployment resource in Kubernetes. The `--image` flag specifies the container image, and `--replicas=3` sets the desired number of pod replicas, which matches the requirement exactly.
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 apply deployment web-app --image=nginx:1.21 --replicas=3
Why it's wrong here
kubectl apply expects a manifest file or stdin describing the resource, not imperative flags such as --image and --replicas. Those flags belong to kubectl create deployment. apply is correct when reapplying a saved YAML manifest to reconcile desired state.
- ✗
kubectl run web-app --image=nginx:1.21 --replicas=3
Why it's wrong here
kubectl run creates a single Pod, and --replicas is not a valid flag for it, so the command errors out. run suits quick one-off Pods; a replicated Deployment requires kubectl create deployment with --image and --replicas.
- ✓
kubectl create deployment web-app --image=nginx:1.21 --replicas=3
Why this is correct
`kubectl create deployment` generates the Deployment manifest imperatively, and the `--replicas=3` flag sets `.spec.replicas` directly, satisfying the stem's three-replica constraint. The `--image=nginx:1.21` flag populates the container spec with the exact pinned tag, so a single command yields the named 'web-app' Deployment.
- ✗
kubectl create deployement web-app --image=nginx:1.21 --replicas=3
Why it's wrong here
The subcommand is misspelled as 'deployement', so kubectl rejects it as an unknown command and no Deployment is created. The correct imperative form is kubectl create deployment. The typo is easy to miss because the flags themselves are valid.
Go deeper
Related to this question
About these practice questions
One of 930 original KCNA practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
Same concept, more angles
1 more way this is tested on KCNA
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. Which command is used to create a Deployment that runs an nginx container with 3 replicas?
easy- A.kubectl create pod nginx --image=nginx --replicas=3
- B.kubectl run nginx --image=nginx --replicas=3
- ✓ C.kubectl create deployment nginx --image=nginx --replicas=3
- D.kubectl scale deployment nginx --replicas=3
Why C: `kubectl create deployment` is the standard Kubernetes command to create a Deployment resource, and the `--replicas=3` flag directly sets the desired replica count to 3. This command creates a Deployment that manages a ReplicaSet to ensure three nginx pods are running and maintained.
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This KCNA 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 KCNA exam.