XK0-006 Automation, Orchestration, and Scripting Practice Question
In a Kubernetes cluster, a developer needs to create a Deployment that runs three replicas of a container image 'myapp:1.0' and exposes port 8080. Which YAML snippet correctly defines this Deployment?
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
✓
apiVersion: apps/v1 kind: Deployment metadata: name: myapp spec: replicas: 3 selector: matchLabels: app: myapp template: metadata: labels: app: myapp spec: containers: - name: myapp image: myapp:1.0 ports: - containerPort: 8080
A Deployment YAML must have apiVersion, kind, metadata, spec with replicas and template containing container spec with image and ports.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
apiVersion: v1 kind: Pod metadata: name: myapp spec: replicas: 3 containers: - name: myapp image: myapp:1.0 ports: - containerPort: 8080
Why it's wrong here
Pods cannot have replicas; that is a Deployment property. Also apiVersion should be apps/v1 for Deployment.
- ✗
apiVersion: apps/v1 kind: Deployment metadata: name: myapp spec: replicas: 3 selector: app: myapp template: containers: - name: myapp image: myapp:1.0 ports: - containerPort: 8080
Why it's wrong here
Missing matchLabels in selector, and template should have metadata and spec.
- ✓
apiVersion: apps/v1 kind: Deployment metadata: name: myapp spec: replicas: 3 selector: matchLabels: app: myapp template: metadata: labels: app: myapp spec: containers: - name: myapp image: myapp:1.0 ports: - containerPort: 8080
Why this is correct
Correct. Includes required apiVersion, selector, and template with labels.
- ✗
apiVersion: v1 kind: Deployment metadata: name: myapp spec: replicas: 3 template: spec: containers: - name: myapp image: myapp:1.0 ports: - containerPort: 8080
Why it's wrong here
Missing selector and container port definition is incomplete; also apiVersion for Deployment should be apps/v1, not v1.
Go deeper
Related to this question
About these practice questions
This XK0-006 question is part of Courseiva's 979-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 XK0-006 practice question is part of Courseiva's free CompTIA 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 XK0-006 exam.