Hello All,
Currently i am using the following way to inject secrets into the pod.
vault.hashicorp.com/agent-inject: "true"
vault.hashicorp.com/role: "internal-role"
vault.hashicorp.com/agent-inject-secret-keys1: "internal/data/keys1"
vault.hashicorp.com/log-level: "debug"
vault.hashicorp.com/agent-inject-template-keys1: |
{{- with secret "internal/data/keys1" -}}
export USERNAME_DEV="{{ .Data.data.user }}"
{{- end -}}
vault.hashicorp.com/agent-inject-secret-keys2: "internal/data/keys2"
vault.hashicorp.com/agent-inject-template-keys2: |
{{- with secret "internal/data/keys2" -}}
export PASSWORD="{{ .Data.data.password }}"
{{- end -}}
I am sourcing the above as env variables in the pod.
command: ["/bin/sh", "-ec"]
args: [
"for f in `ls -a /vault/secrets/keys*`; do source $f; done; env > /tmp/env.txt; sleep 1000000",
]
My question is there a way the above method could be improved or some others ways, where i want multiple secret paths to be injected. Thanks