将价值从领事kv传递给游牧民族 [英] Passing a value to nomad from Consul kv

查看:96
本文介绍了将价值从领事kv传递给游牧民族的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从领事那里获取信息,然后将此工作提交给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传递给游牧民族的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆