我正在安装prometheus-redis-exporter Helm图表。它的Deployment对象可以注入注解:
# deployment.yaml
...
template:
metadata:
annotations:
{{ toYaml .Values.annotations | indent 8 }}
Run Code Online (Sandbox Code Playgroud)
通常,如果我提供值文件,则可以执行以下操作:
# values.yaml
annotations:
foo: bar
bash: baz
Run Code Online (Sandbox Code Playgroud)
然后使用以下命令安装图表:
helm install --values values.yaml
Run Code Online (Sandbox Code Playgroud)
但是,在某些情况下,对我来说,在命令行上指定这些值会更简单--set,我只是不确定如何指定这样的嵌套集。
annotations在命令行上安装头盔图表时,如何设置以上对象:
helm install --set <what_goes_here>
Run Code Online (Sandbox Code Playgroud)
该helm实况有一节的格式和--set的限制,其中包含你在找什么。
--set outer.inner=value 结果是:
outer:
inner: value
Run Code Online (Sandbox Code Playgroud)
因此,您的整个helm命令如下所示:
helm install --set annotations.foo=bar,annotations.bash=baz stable/prometheus-redis-exporter
Run Code Online (Sandbox Code Playgroud)
小智 6
只是补充一下,如果您想用“。”覆盖一个键。在键名中,在“.”之前添加一个反斜杠(“\”)。
例如,使用值(取自 grafana):
grafana.ini:
server:
root_url: https://my.example.com
Run Code Online (Sandbox Code Playgroud)
要编辑root_url我们将传递的值
--set grafana\.ini.server.root_url=https://your.example.com