✓ Solved

What is the correct URL to use for GET requests to another Kubernetes container?

I'm not just looking for a solution. I would also like to know what I'm doing wrong. Please see this simple microservice example I'm creating.

In frontend/index.html, I'm trying to $.get("http://analytics-svc:8084/productinfo", but no information is being retrieved. When I tried this in Minikube with localhost:8082/productinfo, it worked. But now I'm trying it by creating an LKE cluster. I'm able to see index.html rendered when I access it via the internet onn http://<workerNodeIP>:30286/. But on clicking the "Get info" button, the JSON object from the analytics app is not accessible.

This is the output of kubectl get all, so I know the pods are up and running:
```
NAME READY STATUS RESTARTS AGE
pod/analytics-go-758d77756b-fkdpx 1/1 Running 0 17s
pod/frontend-jq-77b6f88f9d-ssvxr 1/1 Running 0 16s

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/analytics-svc ClusterIP 10.128.51.177 <none> 8084/TCP 17s
service/frontend-svc LoadBalancer 10.128.93.167 172.xxx.xx.xxx 8083:30286/TCP 16s
service/kubernetes ClusterIP 10.128.0.1 <none> 443/TCP 46h</none></none>

NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/analytics-go 1/1 1 1 19s
deployment.apps/frontend-jq 1/1 1 1 18s

NAME DESIRED CURRENT READY AGE
replicaset.apps/analytics-go-758d77756b 1 1 1 19s
replicaset.apps/frontend-jq-77b6f88f9d 1 1 1 18s
```

Please help with this. I've been stuck for many days and reading through the Kubernetes and Linode documentation isn't helping clear this concept.

1 Reply

✓ Best Answer

So the issue was that the JQuery code was at the client side, so it didn't have access to the service. Also, there was a typo in the analytics selector name.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct