<p>In our project we are deploying our Spring Boot based microservices into Azure using Azure Kubernetes Service and we have a Jenkins Job that creates ConfigMaps with appropriate DB names using Azure CLI . Now I want to get the values of DB Names from the ConfigMap created by Jenkins in my Spring Boot application.properties .
Jenkins job uses following code to create a configmap in AKS</p>
<pre><code>sh '''
     kubectl --kubeconfig ./temp-config create configmap generic ${PSQL_CONFIG} -n &quot;${HEC_NAMESPACE}&quot; \
     --from-literal=hec.postgres.host=${PSQL_SERVER} \
     --from-literal=hec.postgres.dbNames=[${DB_NAMES}] \
     --dry-run=client -o yaml | kubectl --kubeconfig ./temp-config apply ${DRYRUN} -f 
   '''
</code></pre>
<p>Now to get the value of variable DB_NAMES in my Spring Boot app ,</p>
<p><strong>1. Should I create a configMap inside a Spring Boot project and load the DB Values ?</strong></p>
<p><strong>2. Or should I set the DB_NAMES variable in the application.properties  like
hec.postgres.db-name={DB_NAMES}</strong></p>
<p>Once I have DB_NAMES values populated then I can use the way I want in my Code
Please let me know which approach is good</p>

ronan
<p>Yes, define <code>DB_NAMES</code> variable and value in configmap object and load the values from configmap as environment variables inside the container. use those environment variables in the springboot properties file.</p>
