Problem statement
The checkout service calls a small helper on every request, and the two were deployed as separate pods. The app has no way to name the helper: there is no stable address for it, and the one it has today is not the one it will have after its next restart. Namespace bundle-localhost also holds checkout-clash, a pod where two containers tried to take the same port - read it, do not repair it.
About this exercise
A pod is not just a group of containers, it is a group of containers that share one network namespace. That has two consequences, and they are the whole exercise:
- One address for all of them. The pod gets an IP; every container in it reports that same IP as its own. Containers in a pod therefore reach each other on localhost - no address to discover, no name to resolve, no Service in between. This is the tightest coupling Kubernetes offers, and it is what you use when two processes are genuinely one unit rather than two services.
- One set of ports for all of them. Ports are not per container. If one container binds port 8080, that port is taken for the whole pod, and the next container that tries to bind it fails the way any second process binding a taken port fails. Two containers in one pod must use different ports even when they know nothing about each other.
Note what is not shared: filesystems stay separate unless a volume is mounted into both, and log streams stay separate per container - each container's standard output is served on its own.
kubectl explain pod.status.podIP and kubectl logs --help are the reference.
How this project is graded
The grader reads your live pod: what each container reports for its own address, what the app container actually gets back when it calls the helper from inside the pod, and what each container's log stream contains. checkout-clash is read, never repaired - your saved answers are compared against what the cluster reports for it. Re-apply your manifest after every edit; the cluster is graded, not the file.
What you will build
A pod in manifest.yaml, applied to the cluster, and two answers in answers/:
pod checkout, namespace bundle-localhostcontainer helper busybox:1.36 prints HELPER-LISTENING 8080 on its own standard output, then serves HTTP on port 8080, answering a request for /health with the single line HELPER-OK container api busybox:1.36 prints CHECKOUT-API STARTED on its own standard output, then repeatedly requests http://localhost:8080/health and prints each response it receives
answers/localhost-check.txt what a request to http://localhost:8080/health made from inside the api container returns (that line alone) answers/collision.txt the log the cluster serves for the container of checkout-clash that could not take port 8080
Step 1 - one pod, one address
Bring checkout up with both containers running, and confirm from inside each of them that they report the same address - the pod's.
helper_and_api_run_as_one_pod and containers_share_one_pod_ip should pass
Step 2 - the call over localhost
The app must actually reach the helper at localhost:8080 from inside the pod. Make that call yourself, from inside the api container, and save what comes back.
api_reaches_helper_over_localhost and localhost_check_evidence_saved should pass
Step 3 - one port, one owner
checkout-clash shows what the shared network namespace costs. Save the log of the container that lost the port.
port_collision_recorded_on_the_second_binder should pass
Step 4 - two processes, two streams
Sharing an address does not merge the containers. Each one's output stays its own.
per_container_log_streams_isolated should pass
When every test passes
You have:
- Two containers cooperating over localhost with nothing between them
- The pod's single network identity, confirmed from inside both containers
- The cost of that identity, in the words of a container that lost a port race
- Log streams that stay separate even when the network does not
You do not have yet:
- Everything at once. Preparation, a shared file, a localhost call and four containers in one unit is the next exercise.
Verify
Click Test after every step.
