Mock 3, Questions:17 issue

Q: 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.

Many times I solved this problem correctly.
That time a external service was automatically create in respective cluster(cluster3)
so I can solve that,

but now the external service not creating automatically.
please check this issue. Whether i am wrong or have any system issue.

You’re the second person today to ask about the same two questions :laughing:

The external service appears to be present:

student-node ~ ✖ netstat -tunl | grep 9999
tcp        0      0 0.0.0.0:9999            0.0.0.0:*               LISTEN     

student-node ~ ➜  curl http://localhost:9999
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

You are right.
but

student-node ~ ➜ kubectl config use-context cluster3
Switched to context “cluster3”.

student-node ~ ➜ k get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.43.0.1 443/TCP 25m

student-node ~ ➜ netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.11:34563 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:9999 0.0.0.0:* LISTEN 2175/kubectl

Port is running

But the service is running in kube-public namespace

cluster3-controlplane ~ ➜ k get svc -A
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default kubernetes ClusterIP 10.43.0.1 443/TCP 26m
kube-system kube-dns ClusterIP 10.43.0.10 53/UDP,53/TCP,9153/TCP 26m
kube-system metrics-server ClusterIP 10.43.94.190 443/TCP 26m
kube-system traefik LoadBalancer 10.43.106.250 192.7.116.3 80:30345/TCP,443:31487/TCP 25m
kube-public external-webserver-cka03-svcn ClusterIP 10.43.238.201 80/TCP 81s

and

endpoints is presents

k describe svc -n kube-public external-webserver-cka03-svcn
Name: external-webserver-cka03-svcn
Namespace: kube-public
Labels:
Annotations:
Selector: run=server1-cka03-svcn
Type: ClusterIP
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.43.238.201
IPs: 10.43.238.201
Port: 80/TCP
TargetPort: 80/TCP
Endpoints: 10.42.0.19:80
Session Affinity: None
Events:

and site can e accessable,

curl student-node:9999

Welcome to nginx! html { color-scheme: light dark; } body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; }

Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.

But you are still getting the question marked as wrong?

So it is set up slightly differently from the original version of this question

The existing service is connected to a pod in the cluster. You need to remove that association and instead connect it to the external service via an Endpoint

You don’t need to SSH anywhere to do this, it can all be done from student-node

I think you are not understand me,
I have no problem with the question.
firstly many time i resolve this questions.

but my problem is, for this questions a service named “external-webserver-cka03-svcn”
must automatically create in default namespace.

but from some days ago this service is not creating automatically in default namespace.

this is my problem, why the service was not creating.

But yesterday i checked the service is created in kube-public namespace.

Please clarify.

I don’t really think it matters what namespace it is in. The point is to simply connect the service, as you know how to solve it when you know where the service is.

All the question states is that there is a service external-webserver-cka03-svcn, but not where to find it. That is an exercise for the student.