How to define localhost on Kubernetes

7/12/2019

I have a very simple web app and deployed to google Kubernetes(LoadBalancer) and it is working fine. I can access my index.html like this my_external_IP:8080/myweb/html/index.html.

The index.html is a frameset which loads other htmls. But the html URLs are hardcoded like http://localhost/html/my_frame1.html in my code. But Google Kubernetes is complaining about localhost refusing to connect. I can not define localhost to my external IP before I create my war. The external IP is known to me long after.

Deployment info is in the following: LoadBalancer service not reachable

-- ENGLISH TEACHER
google-kubernetes-engine
kubernetes

1 Answer

7/12/2019

As @malathi mentioned, this is not related to Google Kubernetes at all.

Instead of using hardcoded values I recommend using Relative Paths. Basically, all your paths in your initial index.html would need to direct to html/....

-- Rico
Source: StackOverflow