Open Dentrax opened 3 years ago
Hey @Dentrax, thanks for the report.
How did you get the "Actual behavior" (the WARN entries about vault) output you show? It doesn't appear in the "Debug output" and I can't reproduce it. Thanks.
@Dentrax, I had a thought...
Check the home directory of the account you're using to run consul-template for a file, ~/.vault-token. If it sees this file it will enable the vault connection and try to get a token resulting in this warning. Just removing that file will fix it.
Thanks! @eikenb Yes, there was a file in ~
dir called vault-token
. I just deleted it:
$ cat ~/.vault-token
root
$ rm ~/.vault-token
And now the $ consul-template -template "in.tpl:out.txt" -once
command does nothing and being stuck until I send SIGTERM
from keyboard. This log shown up in the agent
as soon as I run the that command:
2021-03-06T21:41:03.815+0300 [DEBUG] agent.http: Request finished: method=GET url=/v1/kv/foo?stale=&wait=60000ms from=127.0.0.1:50257 latency=42.542µs
Any thoughts? Thanks...
:fireworks: Glad that helped @Dentrax.
I think your current issue is that the consul server you are using doesn't have the value the template is looking up. Consul-template blocks until all template variables have their values retrieved before rendering the templates and -once
doesn't exit until all templates have rendered the one time.
I think your current issue is that the consul server you are using doesn't have the value the template is looking up.
I could not understand exactly what it means actually. Do I need to do anything manually before I run consul-template -template "in.tpl:out.txt" -once
t?
@Dentrax I had similar issues with the steps in the documentation. I was able to get around this by passing -vault-renew-token=false
to consul-template
. I think this is because I have vault token being set in one of the three places mentioned here.
This should get you going: consul-template -template "in.tpl:out.txt" -vault-renew-token=false
Reference Issue: https://github.com/hashicorp/consul-template/issues/1297
Using the original example, does the Consul server you are pulling values from have a value store for the foo
key used?
For example, if you have the template with {{ key "foo" }}
in it, just started a test consul with consul agent -dev
and run consul-template like consul-template -template "in.tmpl:out.txt" -once
it will block until that foo
entry has a value. You can do that with the command consul kv put foo "hello"
and if you run that with consul-template already running (like above) and blocking it will unblock and render the file with "hello" in it.
Consul Template version
consul-template v0.25.2 (870905d)
Configuration
in.tpl:
Command
Debug output
Expected behavior
Should work as expected?
Actual behavior
It tries to dial Vault on
tcp 127.0.0.1:8200:
to dorenew-self
.