我要设置slave.extraVolumes
如下。
helm install my-db --set replication.enabled=true,slave.extraVolumes={"db-disk-1","db-disk-2"} bitnami/postgresql -n development
但是它说一个错误
Error: expected at most two arguments, unexpected arguments: bitnami/postgresql
已经测试过的方法:
helm install my-db --set replication.enabled=true,slave.extraVolumes={db-disk-1,db-disk-2} bitnami/postgresql -n development
Error: expected at most two arguments, unexpected arguments: bitnami/postgresql
helm install my-db --set replication.enabled=true,slave.extraVolumes="db-disk-1\,db-disk-2" bitnami/postgresql -n development
Error: YAML parse error on postgresql/templates/statefulset-slaves.yaml: error converting YAML to JSON: yaml: line 115: could not find expected ':'
答案 0 :(得分:2)
(至少)发生了三件事:
slave.extraVolumes
is a list of Volume
structures,因此仅提供两个名称将无法完成--set
语法来表示复杂的结构,因此需要--values
和文件或process substitution helm install my-db \
--set replication.enabled=true \
--values <(echo '{
"slave": {
"extraVolumes": [
{
"name": "db-disk-1",
"emptyDir": {}
},
{
"name": "db-disk-2",
"emptyDir": {}
}
]
}
}') \
bitnami/postgresql -n development
答案 1 :(得分:0)
对于其他来自Google并显示错误消息并希望解决该问题的人,而不是在公认的答案中使用晦涩的postgresql
特定答案,问题几乎可以肯定是mdaniel的要点2(“您正在使用字符至少对于现代bash
而言,对外壳有意义而无需引用它们”。
此答案说明了发生的情况-Stop shell wildcard character expansion?-以及如何解决此问题。在这里,您只需要转义大括号,就像这样:
helm install my-db --set replication.enabled=true,slave.extraVolumes='{"db-disk-1","db-disk-2"}' bitnami/postgresql -n development
或
helm install my-db --set replication.enabled=true,slave.extraVolumes=\{"db-disk-1","db-disk-2"\} bitnami/postgresql -n development
这就是您所需要的。 helm
帮助对此非常恼人。