####### Question : 17 #######
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.
##############
#####DOUBT#######
When checked in the student node a nginx process run by kubectl port-forward command is listening on port 9999 . This is being mapped to port 80 of a pod running in kube-public namespace . Also there is no service called external-webserver-cka03-svcn created in default namespace . Service with such name exists in kube-public namespace . This service has the pod serving nginx as the endpoint . So i deleted the service and created the same service as in file “service.yaml” and created a endpointslice referencing the service created . Also when checked from other pods in the cluster iam able to curl the service . But After the exam when evaluvated this is shown as wrong and it suggests “endpoints” as a solution . So I’m confused with this question . I have shared the manifests which i used to create both . Could you please check the question and help me to figure out where i went wrong ?
#####DOUBT#######
endpointslice.yaml########
apiVersion: discovery.k8s.io/v1
kind: EndpointSlice
metadata:
namespace: kube-public
name: external-webserver-cka03-svcn # by convention, use the name of the Service
# as a prefix for the name of the EndpointSlice
labels:
# You should set the "kubernetes.io/service-name" label.
# Set its value to match the name of the Service
kubernetes.io/service-name: external-webserver-cka03-svcn
addressType: IPv4
ports:
- name: http # should match with the name of the service port defined above
appProtocol: http
protocol: TCP
port: 80
endpoints:
- addresses:
- "192.0.83.3"
####### service.yaml######
apiVersion: v1
kind: Service
metadata:
namespace: kube-public
name: external-webserver-cka03-svcn
spec:
ports:
- name: http
protocol: TCP
port: 80
targetPort: 80
Here the question just is not implemented correctly, so there’s a reason you could not solve it; I’ve looked at the posted solution on the End Exam page, and the setup for the problem is just wrong.
This is already in our tracking system; I’ll see why it has not been fixed yet.
Hi,
@rob_kodekloud
Can we create EndpointSlice for such requirement ? I’m bit confused refering the documentation as this is not mentioned in the current CKA course . In the solution it was recommended to create endpoints . The documentation also specifies that:
The EndpointSlice API is the recommended replacement for Endpoints.
I suspect you can use either. The particular use case that applies to the 9999 problem isn’t well documented anyway, and most of us are used to the endpoint based solution, which is what we document in the lab solution tab. By all means, try solving it using endpointslices. If the grader does not like your answer, make us aware of it, and we’ll fix the lab so it does.
Hi,
@rob_kodekloud
Thanks for the response! I tried using EndpointSlices as the Kubernetes documentation provided a clear example for this approach. Even though I created the EndpointSlice object referencing the service and was able to curl the service from pods within the cluster, the test evaluation marked my solution as incorrect. The solution page then suggested using endpoints instead.
I’m now unsure which approach I should proceed with, and I’m wondering if using EndpointSlices is correct in this case. Additionally, regarding the section:
endpoints:
- addresses:
- "192.0.83.3"
In the endpointslice.yaml file i mentioned the IP of the student node (jump host) here. Is this correct, or should I use a different IP? Since I haven’t worked with EndpointSlices before, I would appreciate any clarification.
Also, could you provide a clearer reference in the Kubernetes documentation for working with endpoints? And, if possible, could you confirm whether the question and its evaluation are correct?
Thanks again for your help!"
Since EPS are preferred over end points, the docs don’t say much about EndPoints any more. I answer the question with EndPoints by using a sample end point (say, for the K8s service) and use that as a template.
In any event, I’ve created a ticket to support EPS for this question, since we really should allow that.
1 Like
Hi,
@rob_kodekloud
I attempted the question once more, but the EndpointSlices solution is still marked as incorrect during evaluation. I hope this issue will be resolved soon. Thank you for your support.