Mock exam 1 CKAD - question 10

question in the lab:
" We have an external webserver running on student-node which is exposed at port 9999 .

We have also created a service called external-webserver-ckad01-svcn that can connect to our local webserver from within the cluster3 but, at the moment, it is not working as expected.

Fix the issue so that other pods within cluster3 can use external-webserver-ckad01-svcn service to access the webserver."
I cloud not understand or solve this question, in the course I was following in kodekloud, there were only 3 types of kubernetes Services: ClusterIP and NodePort and LoadBalancer.
I saw in another discussion that there is another Service type which is external, but I never heard about it.
I want to know the answer please and could you please tell me how should I know about this Service type, have you followed like me the CKAD path in Kodekloud? or is there another course to follow in KodeKloud?

You have to create a ClusterIP service with no selector - because the service is going to represent something that is outside the cluster.

Then you must deploy an Endpoints resource with exactly the same name as your ClusterIP service to hook up the IP and port of the external webserver.

You can see an Endpoints like this

kubectl get endpoints -n default kubernetes -o yaml

Copy it and adjust to fit the question.

1 Like

thank you, I will try it.


It did not work, I cannot resolve the Service name so I cannot curl the Service

You cannot resolve the service name from where?

As shown in the prompt I am accessing kubectl from student-node in the cluster3 context

It is a cluster IP service, so you need to curl it from inside a pod to test it.

kubectl run tester --image wbitt/network-multitool

wait for it to run, then

kubectl exec -t tester -- curl http://external-webserver-ckad01-svn.default.svc:9999

hello, thank you @Alistair_KodeKloud ? I have solved it I think by using just as you said a cluster ip service but with the property “clusterIP: None”, I found that this is to make a headless service.
thank you very much for your help