'Kubernetes Config Map reload issue

I am having Kubernetes Config map in spring boot project and My application should dynamically get the values from config map if any values changes in config map so for that I have used spring cloud kubernetes config like below in bootstarp.yml file

spring:
  profiles: dev, preprod
  cloud:
    kubernetes:
      reload:
        enabled: true
      config:
        enabled: true
        sources:
          - namespace: ${kubernetesnamespace}
            name: ${configmapname}

After deploying the application , If I go and change the config map value I am able to get in application without restart which is expected but If I change the config map value after 1 hour of deployment this new value of config map is not reflecting in application but same I f do after 5 mins of deployment it is working. So what could be the reason.



Solution 1:[1]

what could be the reason

My first suspect would be the application itself. That probably "watches" for the ConfigMap (opens a long-living connection, subscribing for changes on that object). Eventually, those connections may close, which is normal/expected (container restart, etcd leader changes, SDN issues, ...).

I would make sure my application properly acknowledges those and re-connects to the API.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SYN