Using helm-secrets
Helm secrets is a great plugin to avoid checking in secrets in your Source code.
Here, I am using Hashicorp vault to store secrets and retrieve them safely in helm values files while installing helm charts.
Installation
$ helm plugin install https://github.com/jkroepke/helm-secrets
Setup
$ export VAULT_TOKEN="s.VAULT_TOKENEXAMPLEASLDKASKDASDA"
$ export VAULT_ADDR="https://vault.example.com"
$ export HELM_SECRETS_DRIVER=vault
In vault, add the secrets:
In your helm values file, refer to the secret as follows:
db:
db:
database: !vault secret/misp#db_database
username: !vault secret/misp#db_username
pasword: !vault secret/misp#db_password
rootpasword: !vault secret/misp#db_rootpasword
Now change the helm upgrade command as follows:
$ helm secrets upgrade misp ./helm/misp --install --wait --atomic --namespace=misp --create-namespace --values=./helm/misp/values.yaml
The secrets plugin will fetch and update the vault references in values file before invoking the upgrade command on helm.
Note:
To check the result of decoding, you can use:
$ helm secrets dec helm/misp/values.yaml
This will result in vaules.yaml.dec with actual decoded values from Hasicorp Vault.