I have a basic spring cloud microservice that I use in my application. Each of the config and discovery services are built as docker containers and when I use docker-compose
to run them, everything works fine in that the config server loads the properties files from the mounted directly and displays the below in the logs:
2021-11-16 14:29:51.691 INFO 1 --- [nio-8888-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-11-16 14:29:51.691 INFO 1 --- [nio-8888-exec-2] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2021-11-16 14:29:51.713 INFO 1 --- [nio-8888-exec-2] o.s.web.servlet.DispatcherServlet : Completed initialization in 22 ms
2021-11-16 14:29:51.920 INFO 1 --- [nio-8888-exec-2] o.s.c.c.s.e.NativeEnvironmentRepository : Adding property source: file:/data/application-container.properties
web-configuration-1 | 2021-11-16 14:29:51.921 INFO 1 --- [nio-8888-exec-2] o.s.c.c.s.e.NativeEnvironmentRepository : Adding property source: file:/data/hazelcast-service.properties
When I run the same container inside kubernetes, the container comes up fine but doesn't load the property files. I read somewhere that the profile needs to be native which I confirmed is native.
As a result, when my discovery service comes it doesn't get the port # assigned and so starts up on random port. Any idea what could be causing this container running in kubernetes not loading these application properties?