I have vault running in a pod. I can read secrets using vault read.
$ vault read test
Key Value
--- -----
refresh_interval 768h
value world
$ vault kv get test
==== Data ====
Key Value
--- -----
value world
I can use both versions of the Api to see the secrets in vault
When i list vault secret engines i clearly see them:
$ vault secrets list
Path Type Description
---- ---- -----------
secret/ kv key/value secret storage
test/ kv n/a
In my Consul-template template i have the following
[default]
{{ with secret "test"}}
{{ if .Data.value }}
consul_template_value = {{ .Data.value }}
{{ end }}
{{ end }}
My consul-template is a sidecar pod reading the file above and returning the current error :
watcher reported error: vault.read(test): no secret exists at test
[ERR] (cli) vault.read(test): no secret exists at test
I turned on the trace on consul-template sidecar
[TRACE] (view) vault.read(test) starting fetch
[TRACE] vault.read(test2): GET /v1/test?stale=true&wait=1m0s
[WARN] (view) vault.read(test): no secret exists at test (retry attempt 1 after "250ms")
I checked Vault API with a curl
curl -k -H "X-Vault-Token: TOKEN" -X GET https://X.X.X.X/v1/test?stale=true
I get the response
{
"request_id":"aa947343-723a-45fc-cdee-7394c3074a4c",
"lease_id":"",
"renewable":false,
"lease_duration":2764800,
"data":{
"value":"word"
},
"wrap_info":null,
"warnings":null,
"auth":null
}
I found a similar issue on github https://github.com/hashicorp/consul-template/issues/341
Any ideas would be helpful
Resolved i was missing some configuration aspects of CT