简体   繁体   中英

How to Merge the contents of ConfigMaps in Kubernetes

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

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/

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM