Search code examples
kuberneteskubernetes-helm

Password of mysql container keeps changing on upgrade of helm


I have a docker container running a node express server. The password of the connection with a mysql server is stored in environment variables.

I'm experiencing an issue when upgrading with my helm chart, every time I upgrade the password environment value changes. So obviously the connection with mysql stops working. My helm configuration is the one from azure: https://github.com/Azure/phippyandfriends/

There they don't use secrets, so I just created a secret (this was done way back so I kinda forgot how and what the values were) and in the deployment of my server under env:

- name: MYSQL_PASSWORD
  valueFrom:
    secretKeyRef:
      name: server-mysql
      key: mysql-password

I have this kubernetes plugin for my vscode and here I can see the secret and basically it creates a new one, and changes the data? Am I doing something wrong? Or is something not going as expected?

This is still a dev app so I can delete everything if needed :)

I'm still a bit new with kubernetes so it is possible that I did or forgot something stupid :/


Solution

  • you can pass mysql.existingSecret as a value with the name of your secret and it will use that one.