Kubernetes/OC ConfigMap vs config in git and process in container to watch for changes Kubernetes/OC ConfigMap vs config in git and process in container to watch for changes kubernetes kubernetes

Kubernetes/OC ConfigMap vs config in git and process in container to watch for changes


Both are good options to handle configuration.

Git approach has the advantage of versioned configuration but you'll need an extra container to be coded and maintained.

For me configmap is the best option. As it is a Kubernetes native object you don't need a git repo nor a git container, it is just stored and preserved in etcd, much more easy to maintain.

Moreover, there are some open source projects that can help you with using configmaps: I use kube-backup to have a versioned copy of every config,and configmapcontroller to auto-rollout deployments when a configmap changes.


If you are running multiple services sharing a config the best way is to use Spring Cloud Config. This runs a config server backed by Git and the applications fetch the config from there.

For a simpler solution I would prefer ConfigMaps (or Secrets). There is a very good integration of Spring and Kubernetes for handling ConfigMaps and Secrets including reloading on change: Spring Cloud Kubernetes. The project is currently in incubation but is already quite mature (since it has been developed several years under Red Hat/Fabric8).