we have multiple, more than 10 services running on Kubernates.
And for now have three environments(development, staging, production).
So probably we need three
application.conf file, and currently one is in the project for the development.
Maybe we can make three files like
application-prod.conf and let k8s use those file explicitly.
My question is what is the best practice for k8s environment?
Any advice or documentation will be welcomed.
Your goal should be to have docker image transparent to k8s environment. One image version for any k8s environment.
To achieve this k8s environment specific configuration should not be configured in application.conf that is bundled in a docker image.
You could configure it using environment variables specified in k8s deployment resource that will be, in this case, specific per k8s environment.
@aklikic is right absolutely.
But we use k8s ConfigMap for environment specific config. It’s very useful, IMHO.
apiVersion: v1 data: conf: | foo.bar = "value" play.http.secret.key = "play-http-secret-key-test" kind: ConfigMap metadata: name: service-config
Add ConfigMap data to a Volume
For example volume
- Add include to base configuration file
Hi Alan, thank you for your reply and sharing your thoughts!
Hi Sergey, thank you for sharing your experience.
Currently we are digging into what you gave to me, and I have couple of more questions. If you can let us know more, really appreciate!
So far as I understood,
-make xxx.conf file based on configMap like populate-a-volume-with-data-stored-in-a-configmap using
-add include of xxx.conf file to the base configuration file(application.conf)
My question is,
- Is my understanding correct and proper way to do?
- for example if we have our application.conf file in projectFolder/src/main/resources/application.conf and we want to add xxx.conf file to same
resourcesfolder, mountPath should be
- is there some kind of naming convention for the conf file of Lagom?
Any advice will be welcome!
- I’m not sure that it is possible, because resource files adding to jar. You can’t mount
ConfigMapas one file in the jar.
- No. But usually adding semantic of the environment to the name of the file. For example
production.conf. It’s your choice
Really thank you Sergey, it was really helpful!!
Hope you have a great day!