Kubernetes provides a very elegant mechanism for managing configuration for pods using ConfigMaps. What's not clear from the documentation is what the recommended practice is for using ConfigMaps to manage different configurations for different environments, and also to deploy configuration changes when they occur.

Assume I'm using a ConfigMap for my pod to set various environment variables or to inject cofiguration files into my container. Evidently some (or all) of those variables or files need to be different depending on which environment the pod is deployed to.

In an ideal world I can make configuration changes and deploy those to the pod without re-building or re-deploying the container image. The implication is that those configuration settings, and the ConfigMap, should probably be stored in a separate source code repository (otherwise a build of the image would be triggered every time configuration changes).

What are some recommended practices for:

  1. maintaining different configuration settings per environment (e.g. separate branch per environment)

  2. automatically deploying configuration changes when they change under source control, but only to the respective environment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.