<p>I have this microservice based on Spring Boot 2.2.7 and it works very well when locally. However when I try to deploy in a Kubernetes cluster, it fails on loading the Config Map values at the startup and, consequently, everything fails from this point:</p>
<p>The container logging is this:</p>
<pre><code>2022-02-08 14:54:50.696  WARN [myservice,,,] 1 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for &quot;http://localhost:8761/config/myservice/dev/master&quot;: Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused 
</code></pre>
<p>I have a bootstrap.yml file like this:</p>
<pre><code>jhipster:
  registry:
    password: admin

spring:
  application:
    name: myservice
  profiles:
    # The commented value for `active` can be replaced with valid Spring profiles to load.
    # Otherwise, it will be filled in by maven when building the JAR file
    # Either way, it can be overridden by `--spring.profiles.active` value passed in the commandline or `-Dspring.profiles.active` set in `JAVA_OPTS`
    active: #spring.profiles.active#
  cloud:
    config:
      fail-fast: false # if not in &quot;prod&quot; profile, do not force to use Spring Cloud Config
      uri: http://admin:${jhipster.registry.password}@localhost:8761/config
      # name of the config server's property source (file.yml) that we want to use
      name: myservice
      profile: dev # profile(s) of the property source
      label: master # toggle to switch to a different version of the configuration as stored in git
      # it can be set to any label, branch or commit of the configuration source Git repository
</code></pre>
<p>This is my bootstrap-prod.yml</p>
<pre><code>spring:
  application:
    name: myservice
  cloud:
    kubernetes:
      config:
        enabled: true # enables fetching configmap
        name: myservice
        profile: prod
        sources:
         - name: myservice
      enabled: true # enables all the sub-configurations
</code></pre>
<p>It's like when the application starts, Spring Boot just ignored my bootstrap-prod.yml.</p>
<p>The container's environment variable SPRING_PROFILES_ACTIVE value is &quot;prod,swagger,no-liquibase&quot;.</p>

<p>I finally found out the cause of this problem.</p>
<p>It's necessary to include this dependency in the pom.xml:</p>
<pre><code>&lt;dependency&gt;
   &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
   &lt;artifactId&gt;spring-cloud-kubernetes-config&lt;/artifactId&gt;
   &lt;version&gt;${spring-cloud-kubernetes.version}&lt;/version&gt;
&lt;/dependency&gt;
</code></pre>
<p>In my case it was a little more tricky because I had this dependency already, but it was inside a &quot;prod&quot; profile. So just had to run maven specifying this profile:</p>
<pre><code>mvn package -P prod
</code></pre>
