Kubernetes Spring Cloud Multiple Config Maps being used

9/12/2017

As per the documentation at - https://github.com/spring-cloud-incubator/spring-cloud-kubernetes/#configmap-propertysource, it is possible to make ConfigMaps available during application bootstrapping through adding spring.cloud.kubernetes.config.name to the bootstrap.yaml/properties.

Is it possible to consume multiple ConfigMaps in this manner?

I believe it is possible to do this in the pod specification through the use of env-from - https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/. But it would be great to do this with the current setup that we have.

-- George Cook
kubernetes
spring-cloud

2 Answers

1/10/2019

Maybe the spring.cloud.kubernetes.config.sources config is also an option here. Here you can specify multiple configmaps.

See https://cloud.spring.io/spring-cloud-static/spring-cloud-kubernetes/1.0.0.M2/multi/multi__configmap_propertysource.html

-- IHaanstra
Source: StackOverflow

9/13/2017

As you can see in ConfigMapPropertySource.java, only one ConfigMap will be used by this property source.

However, using envFrom, all entries in a ConfigMap can be provided as environment variables to the container and Spring Boot can also read environment variables, so maybe this will help you.

-- user3151902
Source: StackOverflow