Courseiva
Kubernetes FundamentalsmediumMultiple ChoiceObjective-mapped

KCNA Kubernetes Fundamentals Practice Question

Which command creates a Deployment named 'nginx-deployment' from the image 'nginx:1.25' and exposes it on port 80?

⚠ Common exam trap

Test-takers frequently confuse `kubectl run` with `kubectl create deployment`, as `kubectl run` can create a pod but not a Deployment in modern Kubernetes, and they may think the `--port` flag works with `kubectl run` when it does not.

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 nginx-deployment --image=nginx:1.25 --port=80

The `kubectl create deployment` command is the standard way to create a Deployment resource in Kubernetes. The `--image=nginx:1.25` flag specifies the container image, and the `--port=80` flag sets the container port in the pod template spec, which allows the Deployment to expose the container on port 80.

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 deployment nginx-deployment --image=nginx:1.25 --port=80

    Why this is correct

    This creates a Deployment with the specified image and port exposure.

  • kubectl run nginx-deployment --image=nginx:1.25 --port=80

    Why it's wrong here

    This creates a Pod, not a Deployment.

  • kubectl apply -f nginx-deployment.yaml

    Why it's wrong here

    This applies a manifest, but no YAML file is given.

  • kubectl expose deployment nginx-deployment --type=ClusterIP

    Why it's wrong here

    This exposes an existing deployment, but does not create it.

About these practice questions

This KCNA question is part of Courseiva's 833-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 →

How Courseiva writes practice questions · Editorial policy

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 creates a Deployment named 'nginx' from the 'nginx:1.19' image?

easy
  • A.kubectl run nginx --image=nginx:1.19
  • B.kubectl create deployment nginx --image=nginx:1.19
  • C.kubectl start deployment nginx --image=nginx:1.19
  • D.kubectl apply -f nginx-deployment.yaml

Why B: The `kubectl create deployment` command is the standard Kubernetes imperative method to create a Deployment resource, and specifying `--image=nginx:1.19` directly sets the container image for the pod template. This command generates a Deployment object that manages a ReplicaSet with the specified image, ensuring declarative updates and rollback capabilities.

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.