Kustomize configMapGenerator

11/21/2019

In kubernetes kustomize.yml, when I use configMapGenerator to pass in some values as env, can I access those variables in deployed springboot application, application.properties file?

kustomize.yml

...
configMapGenerator:
  - name: test-app-config
    env: ./test/applicationsetup.env
...

test/applicationsetup.env

some_key=data1
some_key1=data2

application.properties

APPLICATION_KEY=${some_key}
APPLICATION_KEY1=${some_key1}
-- Sarav
kubernetes
kustomize
spring-boot

1 Answer

11/22/2019

I missed to add configMapRef inside container where I was trying to access the data.

containers:
        - name: test-container
          image: <image>
          envFrom:
            - configMapRef:
                name: test-app-config
-- Sarav
Source: StackOverflow