static content page not working in springboot application deployed in kubernets cluster

7/11/2019

My spring boot application have a simple static html file which I kept in src/main/resources/static/index.html and I have added an extra controller to return this view.

public class HomeController {

    @RequestMapping(path = "${url_prefix}/")
    private String home() {
        return "index.html";
    }

}

On my local machine deploy http://localhost:8080/ navigating to the index.html.

Then the same application is deployed into the kubernettes cluster where if navigate to the page then it returns

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Thu Jul 11 15:32:14 GMT 2019
There was an unexpected error (type=Not Found, status=404).
No message available

I checked the content of the deployed spring boot jar and I can see the index.html in that jar.

  9213 Thu Jul 11 17:10:08 CEST 2019 BOOT-INF/classes/static/index.html

I do not have much info about the kubernettes cluster configuration. I am vey well understood that without much info about the deployment scenario, no one can really help me.

But can some one please shed some lights from higher level point of view ( I know the meaning of 404 error).

-- nantitv
java
kubernetes
spring-boot

0 Answers