How to Merge the contents of ConfigMaps in Kubernetes

8/16/2019

We have our app specific properties specified in the below files

application.properties
application-dev.properties
application-qa.properties

While creating a configmap in kubernetes, I wanted to merge the contents into one single file. Is it possible to merge the contents?

I know we can achieve through kustomize. However we are using Helm Charts and we are not using kustomize.

https://github.com/kubernetes-sigs/kustomize/blob/master/examples/combineConfigs.md

-- Sunil Gajula
configmap
kubernetes

2 Answers

8/16/2019

try this simple trick

cat application*.properties > app.properties && kubectl create configmap myconfigmap --from-file=app.properties

you can use app.properties in helm chart

-- P Ekambaram
Source: StackOverflow

8/16/2019

Place the ConfigMap files inside a folder, and then pass the folder path to the kubectl command:

kubectl create configmap config-name --from-file=path_to_the_folder

Link to follow: https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/

-- Khushboo Kumari
Source: StackOverflow