Ultimate CKA mock exam- exam 3- question 14 - question needs to be corrected

Question

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 within the kubernetes cluster3, but at the moment, it is not working as expected. Fix the issue so that other pods within cluster3 can use external-webserver-cka03-svcn service to access the webserver.

As per the question no where it is mentioned that service external-webserver-cka03-svcn is running on kube-public namespace as it is not running in default namespace.

Also as per the solution,we need to create endpoint manually

apiVersion: v1
kind: Endpoints
metadata:
  # Ensure that the name matches that of the Service
  name: external-webserver-cka03-svcn
  namespace: kube-public
subsets:
  - addresses:
      - ip: <IP-ADDRESS>
    ports:
      - port: 9999

Cant we delete the service and recreate by using

k expose pod

I am unable to find any k8s documentation regarding Kind:EndPoint and as lso it was not covered under the tutorial as well
Please suggest.

This problem shows a characteristic of service resources: if you don’t define a selector block, K8s assumes you know what you’re doing, and will assume you create endponts for the service. So we use the IP address of the student-node for the IP address, and we create an endpoint resource as we do here.

There isn’t an endpoint model in the docs (EndPointSlice is the preferred API), although you can use kubectl explain ep to get hints, or use the “kubernetes” service from the default namespace as a model. We’ll probably update this problem to use EndPointSlices in the relatively near future.

No, because the service is required to reference an external web server, not a pod. And that is done the way Rob has described.

1 Like

HI,Thanks for your answer.
Do you think in actual CKA we need to know the kind:Endpoint as it is not covered anywhere in official k8s documentation

I think it is unlikely. Some of our questions are there to test your ability to find solutions. We don’t limit you to only permitted docs, but if you can solve it from only that, you should.