掌舵干 运行 安装

helm dry run install

我正在尝试使用 --dry-run 选项测试我的开发 helm 聊天部署输出。当我 运行 以下命令尝试连接到 Kubernetes API 服务器时。

连接Kubernetes集群需要干运行选项吗?我只想检查部署 yaml 文件输出。

helm install mychart-0.1.0.tgz --dry-run --debug

Error: Get http://localhost:8080/api/v1/namespaces/kube-system/pods?labelSelector=app%3Dhelm%2Cname%3Dtiller: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it.

Helm's documentation

所述

When you want to test the template rendering, but not actually install anything, you can use helm install --debug --dry-run ./mychart. This will send the chart to the Tiller server, which will render the templates. But instead of installing the chart, it will return the rendered template to you so you can see the output

因此它仍然需要连接到 Tiller 以使用正确的值呈现您的模板。使用 --dry-运行 选项的不同之处在于它实际上不会安装图表。

运行 helm template ./mychart 还有一个选项可以渲染生成的 YAML,而不需要连接到 tiller。 与 helm lint 相结合,它是验证图表有效性的绝佳组合。

helm install --dry-runhelm template 命令之间存在一个小差异:

  • helm install --dry-run 会将您的图表发送到舵柄 将根据 K8S 规范验证并呈现清单文件以及 YAML 验证。

  • helm template 只会生成清单并验证您的 YAML 文件是否有效。但是,它不会检查生成的清单是否是有效的 Kubernetes 资源。参考:Helm Docs

希望对您有所帮助!

改用Helm templatehelm lint

helm lint是您验证图表是否遵循最佳实践的首选工具