Help me to understand exposing a pod

Hi,
In mock exam , exam 5 and question 1, I exposed the pod via a service and in svc description it shows the pod in the endpoint. so svc can route the traffic to 8080 on container. but the result in exam fails because it says I did not expose the container to 8080.
Is it mandatory to explicitly add it to the yaml file? I mean isn’t it just for documentation to have ports in pod yaml file? If svc is working, why test fails?

Hi @powerofviva

I believe you are referring to Q1 of CKAD Ultimate ME 5 (Screenshot below).

The question highlights: The pod’s container should be exposed at port 8080. In this case, there is no need to create a Service object exposing the Pod. Instead, you need to add ports.containerPort to Pod’s container exposing port 8080.

If the question had asked to expose the Pod, then creating a Service would be an appropriate solution.

Hope this helps.