Not clear exercises - n.17 Lab: CKA Mock Exam 3

Hello,

It is not quite clear to me what has to be done in this exercise:

Anyway, the existing service external-webserver-cka03-svcn in kube-public ns is connected to the existing pod server1-cka03-svcn in the same ns.
The endpoint in the service is exactly the IP of the pod, the match label in the service is exactly the same label that the pod has.

In fact I am able to curl the service from any other pod in the cluster. I used pod pod-34 in ns spectra-1267 and it can easily curl service external-webserver-cka03-svcn in ns kube-public

Since the exercise says the web application (i.e. the external-webserver service) needs to listen on port 9999, I then changed the service configuration to listen on that port and tried the curl again. It works.

Service modified to listen on 9999

Curl from external pod to service on port 9999 still works.

The solution of the exercise says that the svc has no endpoints and we have to amend them, but that is not true, as per what I showed above.
Could you please explain to me what is the exercise about and why it does not reflect the real state of the pods/services?

The sentence
" We have an external webserver running on student-node which is exposed at port 9999. We have created a service called external-webserver-cka03-svcn that can connect to our local webserver from …"
is confusing.
The external webserver mentioned in the first sentence is exactly the service called external-webserver-cka03-svcn mentioned in the second sentence.
At the beginning I thought that the 2 things were 2 separated entities and that the external webserver was a Linux service, but could not find the port open nor the service running on the student node.
In addition, the mentioned service does not have port 9999 exposed (but 80). Maybe you can say that it is supposed to be exposed on 9999.

Regards

An external server means something that is not running inside the cluster.

In this case it is a server running as a Linux service on student-node not a pod in the cluster.

You can test it:

student-node $ curl localhost:9999

The exercise is about making this accessible to workloads running inside the cluster. You do this by creating a Service with no selector: because this service doesn’t select pods. Instead you create an Endpoints resource with exactly the same name as a service (that’s how they are linked), which specifies the IP of the Linux node where the external service is running.

There is a detailed solution to this problem here.

You are extremely unlikely to get a question like this in real exam. Some CKA mocks are deliberately more difficult in the hope you’ll find the real exam easier.