<p>I am using <code>spring-cloud-starter-kubernetes-all</code> dependency for reading config map from my spring boot microservices and its working fine.</p>

<p>After modifying the config map i am using refresh endpoint</p>

<pre><code>minikube servie list # to get the servive url 
curl http://192.168.99.100:30824/actuator/refresh -d {} -H "Content-Type: application/json"
</code></pre>

<p>it working as expected and application loads configmap changes.</p>

<p><strong>Issue</strong>
The above working fine if i have only 1 pod of my application but when i do use more that 1 pods only 1 pods picks the changes not all.</p>

<p>In below example only i pod picks the changes</p>

<pre><code>[message-producer-5dc4b8b456-tbbjn message-producer] Say Hello to the World12431
[message-producer-5dc4b8b456-qzmgb message-producer] Say Hello to the World
</code></pre>

<p><strong>minkube deployment</strong></p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: message-producer
  labels:
    app: message-producer
spec:
  replicas: 2
  selector:
    matchLabels:
      app: message-producer
  template:
    metadata:
      labels:
        app: message-producer
    spec:
      containers:
        - name: message-producer
          image: sandeepbhardwaj/message-producer
          ports:
            - containerPort: 8080

---
apiVersion: v1
kind: Service
metadata:
  name: message-producer
spec:
  selector:
    app: message-producer
  ports:
    - protocol: TCP
      port: 80
      targetPort: 8080
  type: LoadBalancer
</code></pre>

<p><strong>configmap.yml</strong></p>

<pre><code>kind: ConfigMap
apiVersion: v1
metadata:
  name: message-producer
data:
  application.yml: |-
    message: Say Hello to the World
</code></pre>

<p><strong>bootstrap.yml</strong></p>

<pre><code>spring:
  cloud:
    kubernetes:
      config:
        enabled: true
        name: message-producer
        namespace: default
      reload:
        enabled: true
        mode: EVENT
        strategy: REFRESH
        period: 3000
</code></pre>

<p><strong>configuration</strong></p>

<pre><code>@ConfigurationProperties(prefix = "")
@Configuration
@Getter
@Setter
public class MessageConfiguration {
    private String message = "Default message";
}
</code></pre>

<p><strong>rbac</strong></p>

<pre><code>apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  namespace: default # "namespace" can be omitted since ClusterRoles are not namespaced
  name: service-reader
rules:
- apiGroups: [""] # "" indicates the core API group
  resources: ["services"]
  verbs: ["get", "watch", "list"]

---
apiVersion: rbac.authorization.k8s.io/v1
# This cluster role binding allows anyone in the "manager" group to read secrets in any namespace.
kind: ClusterRoleBinding
metadata:
  name: service-reader
subjects:
- kind: User
  name: default # Name is case sensitive
  apiGroup: rbac.authorization.k8s.io
roleRef:
  kind: ClusterRole
  name: service-reader
  apiGroup: rbac.authorization.k8s.io
</code></pre>

<p>This is happening because when you hit <code>curl http://192.168.99.100:30824/actuator/refresh -d {} -H "Content-Type: application/json"</code> kubernetes will send that request to one of the pods behind the service via round robin load balancing. </p>

<p>You should use the <a href="https://cloud.spring.io/spring-cloud-static/spring-cloud-kubernetes/1.1.0.RELEASE/reference/html/#propertysource-reload" rel="nofollow noreferrer">property source reload feature</a> by setting <code>spring.cloud.kubernetes.reload.enabled=true</code>. This will reload the property whenever there is a change in the config map hence you don't need to use the refresh endpoint.</p>
