Inject secrets as Environment Variables

Hello ,

I have vault-injector deployed to my k8s cluster to inject the secrets from Vault into my cluster, I added vault-agent annotations to my helm chart as below and I’m wondering if there is a way to have the secret template in key=value format "true" "update" "role-name" "path/to/vault/secret" "path/to/vault/secret" |
         {{- `{{ with secret "path/to/vault/secret" }}
            {{- range $key, $value := }}
               {{ $key }}={{ $value }}
         {{- end -}} `}}

when the vault-init running it calls the template.server but when init job ends the injected file content map of array or JSON but not key=value format

Anyone has played with before? Any advise?

Thanks in advance,


  • prefixing any {{ by {{`
  • and suffixing any }} by `}}

By that you are telling Helm to skip template interpolation


Thank you @abdennour , I used CSI Driver for injecting the secrets instead of vault-injector … just found it more useful for my use case.