I'm trying to mount a file using configmap during kubernetes deployment. I have my application properties as data in my configmap. I'm creating configmap using kustomize
. Kustomize will help to merge two configmaps. When I build kustomize
it returns configmap like
apiVersion: v1
data:
append.properties: |
TEST_PROPERTY_1=5
base.properties: |
TEST_PROPERTY_2=test
kind: ConfigMap
metadata:
name: test-configmap
When I mount this config map it will create two different files. But I want to merge into a single file. my application server will expect a single property file. Can someone help this problem?
I'd suggest using a startup script to merge these two files into one property file when the pod startup.
I think config mixin documentation is what you are looking for. You are probably just missing the
behavior: merge
in the configMapGenerator of your overlay.
you can try this
apiVersion: v1
data:
append.properties: |
TEST_PROPERTY_1=5
TEST_PROPERTY_2=test
kind: ConfigMap
metadata:
name: test-configmap
you can also look at loading properties from the two files as env variables, like below
envFrom:
- configMapRef:
name: append.properties