CKA · Question #3
Create a pod named kucc8 with a single app container for each of the following images running inside (there may be between 1 and 4 images specified): nginx + redis + memcached.
Kubernetes Multi-Container Pod: kucc8 Overall Goal Create a single Pod named kucc8 that runs three containers simultaneously - one for each image: nginx, redis, and memcached. This tests your understanding of the Pod spec structure, specifically that a Pod is not limited to one…
Question
Explanation
Kubernetes Multi-Container Pod: kucc8
Overall Goal
Create a single Pod named kucc8 that runs three containers simultaneously - one for each image: nginx, redis, and memcached. This tests your understanding of the Pod spec structure, specifically that a Pod is not limited to one container.
This is correct because Kubernetes Pods are the atomic unit of deployment and natively support multiple containers sharing the same network namespace and (optionally) storage volumes.
The Approach
The fastest correct method on an exam is using kubectl run to generate a base YAML, then editing it to add the remaining containers.
Step-by-Step
Step 1 - Generate a base manifest
kubectl run kucc8 --image=nginx --dry-run=client -o yaml > kucc8.yaml
--dry-run=clientprevents actual creation;-o yamldumps the spec.- This gives you a valid skeleton so you don't write YAML from scratch (avoiding typos in indentation or required fields).
- If skipped: Writing raw YAML without a template on exam time is error-prone and slow.
Step 2 - Edit the manifest to add the remaining containers
Open kucc8.yaml and add redis and memcached under spec.containers:
apiVersion: v1
kind: Pod
metadata:
name: kucc8
spec:
containers:
- name: nginx
image: nginx
- name: redis
image: redis
- name: memcached
image: memcached
- Each entry in
spec.containersis a separate container within the same Pod. - Container names must be unique within the Pod - using the image name as the container name is the simplest convention.
- If skipped: You'd create a Pod with only
nginx, which fails the question entirely.
Step 3 - Apply the manifest
kubectl apply -f kucc8.yaml
- This submits the Pod spec to the API server.
- If you used
kubectl createinstead, re-running after a fix would fail with "already exists" -applyis idempotent.
Step 4 - Verify
kubectl get pod kucc8
kubectl describe pod kucc8
- Confirm
3/3containers areRunningand the Pod name is exactlykucc8. - A common mistake is a typo in the Pod name - the exam grader checks the exact name.
What Goes Wrong Without Each Step
| Skipped Step | Consequence |
|---|---|
--dry-run generation | Manual YAML errors, indentation bugs |
| Adding all containers | Pod only runs one image, question fails |
| Verifying | Silent misconfiguration goes undetected |
Memory Tip
"One Pod, many containers - all siblings under
spec.containers."
Think of a Pod as an apartment: each container is a roommate. They share the same address (network/IP) but are separate processes. The exam question is just asking you to move in the right number of roommates.
Topics
Community Discussion
No community discussion yet for this question.