Those errors come from the script /vault/secrets/database-config, right? So you do have it mounted and being executed, but it doesn’t seem to be a valid script. Trying to call a command data: or something.
That is a stringified golang struct. I assume it’s the .Data struct from which you tried to print only .Data.username into the template.
It’s clear that the file contents don’t match the template you provided (e.g. don’t contain export username=). I don’t know why this is because never used Vault. Make sure to check that you’re using the latest version, etc.
I think the problem is a mismatch between your annotations:
[vault.hashicorp.com/agent-inject-template-config](http://vault.hashicorp.com/agent-inject-template-config)```
One has `database-config`, one has just `config`.
> • [vault.hashicorp.com/agent-inject-template](http://vault.hashicorp.com/agent-inject-template) - configures the template Vault Agent should use for rendering a secret. The name of the template is any unique string after [vault.hashicorp.com/agent-inject-template-](http://vault.hashicorp.com/agent-inject-template-), such as [vault.hashicorp.com/agent-inject-template-foobar](http://vault.hashicorp.com/agent-inject-template-foobar). This should map to the same unique value provided in [vault.hashicorp.com/agent-inject-secret-](http://vault.hashicorp.com/agent-inject-secret-). If not provided, a default generic template is used.
> •
> •
>
, One more thing if you can help me out, everything is working fine but when I added source command for the file inside args, it did not executed, meaning when I try ‘env’, i see no variable was there.
But note: If I try to do source <configfilename> manually inside the pod, I can successfully set the variable inside envrionment variable. So can you suggest me something?