skip to Main Content

I am deploying a spring boot application and is considering various options for externalize configuration. I came to know below options.

1) ConfigMap
2) properties/yaml file in Git and a process in container to watch for changes and restart the application with new properties if there are any changes.

This is not only related to application only, But can be relevant for other components as well like proxies(apache RP,nginx)/load balancers etc.

Thanks

2

Answers


  1. 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.

    Login or Signup to reply.
  2. 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).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search