<p>Currently I have a locally running kubernetes cluster minikube for testing purposes which is using configmap via environment variables.</p>
<p>When I do a get call(/path), I have a map of values that I create within Java.</p>
<p>For example I have @Value(${homepage}) and then assign that to String homepage.</p>
<p>I then create a Java map but my app-config file is set so that my deployment.yaml uses envFrom. Is there a way to pull ALL env variables in the configmap to Java? Rather than grabbing each value statically one by one. Should I be using configmap Volume instead of configmap env map approach. The concern is the hot reloading mechanism wouldn’t work where someone would have to update springboot controller code to add the new value that gets added.</p>
<p>Second line of map.put newval is something I want to avoid and hoping to pull all env variables at once rather then doing one by one.</p>
<p>(Picture got uploaded twice on accident)</p>
<p>Reference of tutorial I followed: <a href="http://learning-madeeasy.blogspot.com/2020/10/access-kubernetes-configmap-in-spring.html?m=1!%5Benter" rel="nofollow noreferrer">http://learning-madeeasy.blogspot.com/2020/10/access-kubernetes-configmap-in-spring.html?m=1![enter</a> image description here](<a href="https://i.stack.imgur.com/M1Nl9.jpg" rel="nofollow noreferrer">https://i.stack.imgur.com/M1Nl9.jpg</a>)<img src="https://i.stack.imgur.com/JNmju.jpg" alt="enter image description here" /><img src="https://i.stack.imgur.com/2WeqF.jpg" alt="enter image description here" /></p>

codeblooded
<blockquote>
<p>Is there a way to pull ALL env variables in the configmap to Java?</p>
</blockquote>
<p>You can use the <strong>config map</strong> or <strong>secret</strong> to store all the environment variables</p>
<pre><code>envFrom:
  - configMapRef:
    name: cred
</code></pre>
<p>adding the block into the <code>deployment.yaml</code> will inject all the config map variables to POD os level and your application can access all those variables.</p>
<p>Read more at : <a href="https://matthewpalmer.net/kubernetes-app-developer/articles/ultimate-configmap-guide-kubernetes.html" rel="nofollow noreferrer">https://matthewpalmer.net/kubernetes-app-developer/articles/ultimate-configmap-guide-kubernetes.html</a></p>
