I have vault server & agent setup in two k8s.
and running nice in dev env cluster, but does not in prod env cluster.
I have configured the same in both k8s clusters, and only prod vault generates empty secret file for pods. although, In dev env, it generates right secret file.
I want to here how to debug.
here’s my configuration.(both same in dev, prod env)
- running vault server in HA mode(dev replica=1, prod replica=2)
- installed via helm
- all initialized and unsealed
- k8s auth enabled, configured, bound to SA with right policy
- pod deployments have annotations for vault injector
vault.hashicorp.com/agent-inject: 'true'
vault.hashicorp.com/agent-inject-secret-credential.json: nubison
vault.hashicorp.com/agent-inject-template-credential.json: |
{{ range sprig_list
"nubison/server"
"nubison/mysql"
-}}
{{ $key := . | regexReplaceAll "^nubison/" "" -}}
{{ $collect := (secret .).Data.data | explodeMap -}}
{{ scratch.MapSet "vars" $key $collect -}}
{{ end -}}
{{ scratch.Get "vars" | toJSONPretty -}}
vault.hashicorp.com/agent-run-as-user: '1337'
vault.hashicorp.com/role: nubison-read
in dev cluster, agent generates credential.json
{
"mysql": {
"user": "lalala"
...
},
"server:" {
"token": "alalal"
...
}
}
in prod cluster, agent generates credential.json
{
"mysql": {},
"server:" {}
}
prod vault server has the secrets too.
and I see no error or suspicious agent log.
any advice please?