'OpenShift: How to externalise application configuration
The 3rd factor of "The twelve-factor app", states that the application configuration must be stored in the environment.
For the image of a Quarkus application deployed on OpenShift, what is the best solution: where can I put the application configuration?
Thanks a lot. Kind regards.
Solution 1:[1]
ConfigMaps are designed for this exact purpose. (The opening line of the documentation is "Config maps allow you to decouple configuration artifacts from image content to keep containerized applications portable.") Secrets are the equivalent functionality for sensitive information.
ConfigMaps generally the I recommend for most situations. Because, as you say, this is a universal solution that can be used for all kinds of applications, no matter how they are implemented. Pods have many ways of accessing ConfigMaps , all OpenShift and Kubernetes tools will understand how to work with ConfigMaps (icluding things like CI/CD), and ConfigMaps are native API resources. Because they are so pervasive, many frameworks also have native support for them. Including Quarkus which was your specific example.)
That said, you also ask in your comments about whether you can use Consul. Absolutely you can, Consul is certified on OpenShift. There are LOTS of third party solutions. And there are reasons that people choose to use them.
But if you ask the generic question "How do you do this in OpenShift?" I will point you to ConfigMaps. If you want to use something else (like Consul) then how you access and manage that config really has to be a question for that product. It looks like there is a Quarkus extension for Consul, but I don't know anything about it.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | David Ogren |
