我用的是Helm 3和microk8s。当我尝试跑步时:
microk8s.helm install <...> --dry-run --debug我看到错误就像
Error: YAML parse error on ./templates/deployment.yaml: error converting YAML to JSON: yaml: mapping values are not allowed in this context
helm.go:76: [debug] error converting YAML to JSON: yaml: mapping values are not allowed in this context
YAML parse error on ./templates/deployment.yaml
helm.sh/helm/v3/pkg/releaseutil.(*manifestFile).sort
/home/circleci/helm.sh/helm/pkg/releaseutil/manifest_sorter.go:129
helm.sh/helm/v3/pkg/releaseutil.SortManifests
/home/circleci/helm.sh/helm/pkg/releaseutil/manifest_sorter.go:98
helm.sh/helm/v3/pkg/action.(*Configuration).renderResources
/home/circleci/helm.sh/helm/pkg/action/install.go:455
helm.sh/helm/v3/pkg/action.(*Install).Run
/home/circleci/helm.sh/helm/pkg/action/install.go:214
main.runInstall
...我发现了几个有类似错误的问题,但答案通常只是要求读取图表代码。我有一个很大的图表,需要自己调试这个错误。猜测它抱怨的是哪一行似乎没有意义。
有什么方法可以知道配置中到底有什么问题吗?
发布于 2021-05-04 13:36:56
尝试:helm template ... --debug > foo.yaml
这将将呈现的图表输出到foo.yaml (并将舵错误堆栈跟踪输出到stderr)。然后,从舵机错误中查找有问题的模板文件名,并查看呈现的图表中类似于# Source: the-template-name.yaml的一行。对每个YAML对象分别执行YAML到JSON的转换,因此您可能有同一个# Source: the-template-name.yaml的多个实例。
查看每个# Source: ...注释下面的n行以获得一个错误,其中n是Helm报告的错误的行号。
https://stackoverflow.com/questions/59564379
复制相似问题