问题描述
从领事那里获取信息,然后将此工作提交给Nomad,将领事k/v值作为环境变量注入.
fetch the information from Consul and then submit this job to Nomad, injecting the Consul k/v value as an environment variable.
例如,我在领事k/v中的值为
like for example i have a value in consul k/v which is
testData = "HELLO"
另一方面,在我的工作中.
on the other hand, in my job.
我希望将领事k/v中的值作为值注入到env节中.
i want the value from consul k/v to be injected to env stanza as a value.
env
CONSUL_test = <value of consul k/v testData>
这可能吗?
这样,当我检查docker env时,我必须看到
so that when i inspect the docker env, i must see
CONSUL_test = HELLO
推荐答案
nomad使用consul模板,因此您可以通过{{ key "myKey" }}
在nomad规范中引用consul k/v值. https://www.nomadproject.io/docs/job-specification/template. html
nomad uses consul-templating, so you can reference consul k/v values in your nomad spec by doing {{ key "myKey" }}
. https://www.nomadproject.io/docs/job-specification/template.html
这篇关于将价值从领事kv传递给游牧民族的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!