Courseiva
Application Design and BuildmediumMultiple ChoiceObjective-mapped

CKAD kubectl run Practice Question

You want to create a Deployment that runs 5 replicas of a web application. Which kubectl command should you use?

⚠ Common exam trap

The trap is that candidates might incorrectly believe `kubectl run` with `--replicas` creates a Deployment, as it did in earlier Kubernetes versions. In the CKAD exam environment (Kubernetes 1.31+), `kubectl run` only creates a Pod, and `kubectl create deployment` is the correct imperative command for creating a Deployment with replicas.

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 webapp --image=nginx --replicas=5

To create a Deployment with 5 replicas using a single imperative command, use `kubectl create deployment webapp --image=nginx --replicas=5`. This command directly creates a Deployment and sets the desired replicas. Option A (`kubectl run`) no longer creates a Deployment by default in current Kubernetes versions (1.18+); it creates a single Pod and does not support the `--replicas` flag. Option B (`kubectl create pod`) does not exist and is incorrect. Option C (`kubectl apply -f deployment.yaml`) would also create a Deployment but requires an existing YAML file and is not a single imperative command.

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 run webapp --image=nginx --replicas=5

    Why it's wrong here

    In current Kubernetes, `kubectl run` is designed to create a single Pod (or a Job if the restart policy is set), not a Deployment. The `--replicas` flag is no longer supported by this command; using it results in an error. Therefore, this command cannot create a Deployment with five replicas, and is incorrect as an imperative one-liner.

  • kubectl create pod webapp --image=nginx --replicas=5

    Why it's wrong here

    The `kubectl create` subcommand supports many resource types such as deployment, service, configmap, and namespace, but 'pod' is not a valid type for direct creation. Executing `kubectl create pod webapp --image=nginx --replicas=5` would immediately fail with an 'unknown resource type' error. There is no imperative 'create pod' command; pods are normally created via `kubectl run` or by applying a manifest.

  • kubectl apply -f deployment.yaml

    Why it's wrong here

    While `kubectl apply -f deployment.yaml` can create a Deployment if the YAML file exists with the correct definition, it is not a self-contained imperative command to generate a Deployment from scratch. It requires you to have already authored or sourced the manifest, which is outside the scope of the question. The question asks for a direct command to create the Deployment, so this declarative approach is not the most suitable answer.

  • kubectl create deployment webapp --image=nginx --replicas=5

    Why this is correct

    The correct imperative command is `kubectl create deployment webapp --image=nginx --replicas=5`. This creates a Deployment named webapp with the nginx container image and sets the desired replica count to 5. It is a fully supported current kubectl command that accepts `--replicas` to scale the Deployment at creation time, making it the most direct way to satisfy the requirement.

About these practice questions

One of 160 original CKAD 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 →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This CKAD 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 CKAD exam.