CKAD Application Design and Build Practice Question
A team wants a Pod to expose two containers: a web server container listening on port 8080 and a metrics exporter container listening on port 9100. The Pod manifest must give each container its own containerPort so that monitoring tools can discover them. Which YAML snippet correctly declares both container ports in a single Pod?
⚠ Common exam trap
Watch out — candidates often confuse Pod-level or Service-level port fields with the per-container containerPort field required in a Pod manifest.
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
✓
spec: containers: - name: web image: nginx ports: - containerPort: 8080 - name: metrics image: exporter ports: - containerPort: 9100
Container ports belong inside each container's ports list under the Pod spec. Declaring containerPort 8080 for the web container and 9100 for the metrics container correctly describes two separate listeners in one Pod, matching the requirement for per-container port declarations.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
spec: containers: - name: web image: nginx ports: - containerPort: 8080 - name: metrics image: exporter ports: - containerPort: 9100
Why this is correct
Each container in the Pod has its own ports list, and containerPort is declared per container. This snippet defines two containers, each with the appropriate containerPort, which matches the requirement that the web server and metrics exporter advertise ports 8080 and 9100 respectively.
- ✗
spec: containers: - name: web image: nginx ports: - name: web port: 8080 - name: metrics image: exporter ports: - name: metrics port: 9100
Why it's wrong here
Container ports use the field containerPort, not port. The port field is used in Service definitions, so this snippet would fail validation because the container ports schema does not recognize port at that level, leaving the containers without declared container ports.
- ✗
spec: containers: - name: web image: nginx ports: - containerPort: 8080 - containerPort: 9100 - name: metrics image: exporter
Why it's wrong here
Both containerPort values are assigned to the web container, while the metrics container has none. This misrepresents the topology: the exporter would not advertise port 9100, and the web container would incorrectly claim to listen on a port it does not use.
- ✗
spec: containers: - name: web image: nginx - name: metrics image: exporter ports: - containerPort: 8080 - containerPort: 9100
Why it's wrong here
The ports field is placed at the Pod spec level, but Kubernetes only accepts ports inside an individual container definition. A Pod-level ports field is invalid, so this manifest would be rejected by the API server and neither container would declare its listening port.
Go deeper
Related to this question
About these practice questions
Courseiva writes every CKAD question from scratch — 826 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official CNCF exam blueprint
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.