Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring backend load balancer service is not accessible from the frontend #39

Open
himanshu85k opened this issue Mar 3, 2021 · 4 comments

Comments

@himanshu85k
Copy link

The sa-web-app-lb Loadbalancer service is running on URL 192.168.49.2:31752
image

I placed this URL in App.js file
image

When I try to make a POST request to backend the connection times out,
image

However when I expose the sa-web-app-lb service using minikube service sa-web-app-lb, I am able to access it via Postman

image

What am I possibly doing wrong?

@hoangvu6995
Copy link

same problem with me, im using minikube k8x in a container

@sangle18
Copy link

same problem

@arhamGH
Copy link

arhamGH commented Aug 12, 2022

Faced this same problem, you need to follow this https://minikube.sigs.k8s.io/docs/handbook/accessing/#loadbalancer-access and your calling url will become something similar like fetch('http://localhost:8080/sentiment' note only the port is changed to 8080 cus we cant run or at least i could not make 2 LoadBalancer run on same port i:e 80 and behave correctly, Of-course service-sa-web-app-lb.yaml would also reflect the same change

@ericboszin
Copy link

It appears you need to expose the sa-web-app-lb service and connect to the tunnel port (of the form 127.0.0.1:<port>).

This is consistent with the architecture diagram where the client sends requests from the frontend (1) directly to the webapp load balancer that sends a request from the client (2 -> 3) vs the frontend pod sending the request to the webapp load balancer inside the Kubernetes network.
image

Thus, the following needs to be changed:

  1. Follow the same steps up to the point where you check the sa-web-app-lb URL.
  2. Execute minikube service web-app-lb and identify the local URL returned
  3. Update line 23 in App.js with this URL.
  4. Follow the same build steps and submit the sa-frontend deploy and service components to Kubernetes
  • Note 1: there is room to improve the Dockerfiles for sa-frontend and sa-web-app as they do not encompass the build process within.
  • Note 2: an enhancement to this solution is to parameterize the URL of the WebApp in App.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants