How to create kubernetes configmap from properties file during maven build?

10/9/2019

We have an old java application which has few properties files. We are doing a POC to deploy it in Kubernetes cluster using Helm chart. As of now, we manually creating configmap by copying the content from properties file. If any updates in properties file, as a result the same update should be done in configmap manually. So, Is there any solution available to create a configmap from the properties file during maven build?

Thanks in advance.

-- Raj
configmap
docker
kubernetes
maven

2 Answers

10/9/2019

It can be done by help of volume and volumeMounts.

You can get info from this

-- Tushar Mahajan
Source: StackOverflow

10/10/2019

If you were using Spring Cloud Config in the past to fetch your properties and reload application during change of properties, there is an alternative provided by Spring for Kubernetes which allows fetching and reading the properties from your ConfigMap(s) directly and allows reload when the ConfigMap changes

Reference - https://cloud.spring.io/spring-cloud-static/spring-cloud-kubernetes/1.1.0.M3/reference/html/#kubernetes-propertysource-implementations

But looks like there is no solution available yet to generate ConfigMap(s) from property file(s) directly during a maven build.

-- Harish B
Source: StackOverflow