0

Kubernetes already provides a way to manage configuration with ConfigMap.

However, I have a question/problem here.

If I have multiple applications with different needs deployed in Kubernetes, all these deployments might share and access some common config variables. Is it possible for ConfigMap to use a common config variable?

BMW
  • 42,880
  • 12
  • 99
  • 116
edwin
  • 1,152
  • 1
  • 13
  • 27

1 Answers1

2

There are two ways to do that.

  • Kustomize - Customization of kubernetes YAML configurations (developed as kubernetes sigs, and had been integrated into kubectl command line). But currently it isn't mature enough if compare with helm chart

https://github.com/kubernetes-sigs/kustomize

  • Helm chart - The Kubernetes Package Manager. Its vaules.yaml can define the vaule for same configuration files (in your case, they are configmap) with variables.

https://helm.sh/

BMW
  • 42,880
  • 12
  • 99
  • 116
  • Thanks. One more question. Is there a global variable/values in Helm Chart that can be shared across different services/deployments? – edwin Mar 16 '20 at 04:33
  • then `kustomize` will be suitable for the request. – BMW Mar 16 '20 at 05:29
  • 1
    You can still maintain global variables in helm with a global value.yaml file. During helm command, it can be used like this: ```helm template -f global-value.yaml -f value.yaml .``` – LeonG Mar 16 '20 at 11:36
  • @edwin I have similar use case, curious how you got his working, i used kustomize to extract common properties but im running into the problem that the common props hash is same and its conflicting across different apps. – cheddarDev Jun 17 '21 at 01:03