few-magazine-85406
07/18/2023, 4:22 AM{
"error": {
"cause": {
"errno": -111,
"code": "ECONNREFUSED",
"syscall": "connect",
"address": "127.0.0.1",
"port": 80
}
},
"message": "Unable to reach service at http://backend.rust.local.demo.garden"
}
---
I check the svc with kubectl get svc
and see it doesn't have an ExternalIP.
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
backend ClusterIP 10.105.208.217 <none> 80/TCP 21m
frontend ClusterIP 10.97.105.9 <none> 8080/TCP 16m
---
I execute a curl from ingress pod to backend and it returns
kephalos@dev:~/test-of-rust-with-frontend$ k exec -n garden-system garden-nginx-ingress-nginx-controller-j9gff -- curl -X GET backend.rust.local.demo.garden
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 17 100 17 0 0 55 0 --:--:-- --:--:-- --:--:-- 55Hello, Rust 🦀!
Please let me know if there is any additional info I could provide that could be helpful.
Thank you!quaint-dress-831
07/18/2023, 8:14 AMexamples/demo-project
is that correct?astonishing-tomato-18259
07/18/2023, 11:19 AMECONNREFUSED
error is because the backend URL that you have specified in frontend/app.js is not correct.
please change
const backendServiceEndpoint = `http://backend.rust.local.demo.garden`
with
const backendServiceEndpoint = `http://backend/`
Basically, you do not need to specify the ingress URL there but rather use the service url as it's service-to-service communication between the frontend & backend services inside your namespace.
Please give it a try and let us know if it still doesn't work.few-magazine-85406
07/18/2023, 11:55 AMhttp://backend
. I've even removed the ingress from the backend.garden.yaml and it still works, thinking maybe there was some "behind the scenes magic" happening.
I thought the flow would be browser->DNS->loadBalancer->service
. How is the browser able to hit the service directly?astonishing-tomato-18259
07/18/2023, 11:59 AM/hello-frontend
and /call-backend
. So browser isn't responsible for calling the backend here but rather the frontend node/express service is responsible for calling the backend.
The name frontend migth be a bit confusing here but in fact the backend & frontend in /demo-project are 2 nodejs services.