Passing a value to nomad from Consul kv

妖精的绣舞 提交于 2020-01-16 18:04:45

问题


fetch the information from Consul and then submit this job to Nomad, injecting the Consul k/v value as an environment variable.

like for example i have a value in consul k/v which is

testData = "HELLO"

on the other hand, in my job.

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>

is this possible?

so that when i inspect the docker env, i must see

CONSUL_test = HELLO

回答1:


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



来源:https://stackoverflow.com/questions/56801967/passing-a-value-to-nomad-from-consul-kv

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!