3

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
  • 245
  • 3
  • 12
  • It looks like you are looking for [this](https://github.com/kubernetes-sigs/kustomize/tree/master/examples/springboot) – Mark Nov 21 '19 at 11:42
  • Actually i am looking to do other way around. Looking to pass some_key, some_key1 value to the application.properties. Not sure if it will be available. – Sarav Nov 21 '19 at 17:30
  • It looks like you are looking at [this](https://github.com/kubernetes-sigs/kustomize/issues/1440) – Mark Nov 23 '19 at 21:12
  • Yes. Thanks Hanx. – Sarav Nov 25 '19 at 21:38

1 Answers1

3

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
  • 245
  • 3
  • 12