0

I have a ConfigMap where I have defined some environment variables like log_level.. and referencing them in the deployment.

          envFrom:
        - configMapRef:
            name: test_config_map

After deployment, I have changed some of the values in the config map and restarted the pods.

kubectl edit configmap test_config_map

When I upgrade the helm chart, the modified values are overridden with the default values.

I assume that helm v3 3-way merge will take of the live state and keep the older values. But it doesn't seems to be the case.

Is there any way I can keep the modified values even after upgrade?

Wytrzymały Wiktor
  • 11,492
  • 5
  • 29
  • 37
PGS
  • 1,046
  • 2
  • 17
  • 38
  • 5
    I am not sure if there is acutally a way to do that. However, you should'nt anyways! It's best practice to have your resource definitions, or in the case of using helm charts, your values.yaml files stored in your code repository and not changing things manually on your cluster as this leads to a configuration drift and makes it hard to restore the exact previous version in case of an outage or other emergency – meaningqo Aug 03 '21 at 13:14
  • Hello @PGS. Does the above comment answer your question? – Wytrzymały Wiktor Aug 04 '21 at 09:25
  • Hello PGS, meaningqo. Consider posting the first comment as an answer for better clarity. – Wytrzymały Wiktor Aug 11 '21 at 07:57

1 Answers1

1

This is a community wiki answer posted for better visibility. Feel free to expand it.

As already mentioned in the comments, the best practice is to have your resource definitions, or in the case of using helm charts, your values.yaml files stored in your code repository and not changing things manually on your cluster as this leads to a configuration drift and makes it hard to restore the exact previous version in case of an outage or other emergency.

See the Configuration Best Practices.

Wytrzymały Wiktor
  • 11,492
  • 5
  • 29
  • 37