I am trying run a spring boot application whose application.properties file will be used as a kubernetes configMap.
While deploying the app, I am adding a volume for this config file. But somehow, it is not creating properties file at mount path.
configMap name : integration-properties Data :
application.properties:
http.stub.api.host=localhost
http.stub.api.port=8080
http.stub.api.path=stub-api
Deployment.yaml file :
volumeMounts:
- name: config-volume
mountPath: /opt/build/
volumes:
- name: config-volume
configMap:
name: integration-properties
items:
- key: application.properties
path: application.properties
When I run this application, it says, "/opt/build/application.properties" does not exists.
Please let me know for any further configuration required, if any and steps to do them.
So define configMap as:
data:
application.properties: |
http.stub.api.host=localhost
http.stub.api.port=8080
http.stub.api.path=stub-api
or you can also create directly from the application.properties
file
kubectl create configmap integration-properties --from-file=application.properties=<path to file>
Your deployment.yaml
file looks good to me there isn't any problem.