Helm在本地导出YAML文件(只使用模板引擎,不要发送到Kubernetes)

j9d*_*9dy 10 kubernetes kubernetes-helm

我想将已经模板化的 Helm Charts 导出为YAML文件.我目前无法在我的Kubernetes集群上使用Tiller,但仍想使用Helm Charts.基本上,我希望Helm将使用Helm模板化的值导出发送到Kubernetes API的YAML.之后,我将YAML文件上传到我的Kubernetes集群.

我试图跑,.\helm.exe install --debug --dry-run incubator\kafka但我得到错误Error: Unauthorized.

请注意,我在Windows上运行Helm(版本为helm-v2.9.1-windows-amd64).

Amr*_*era 21

我们需要日志来检查Unauthorized问题.

但您可以在本地轻松生成模板:

helm template mychart
Run Code Online (Sandbox Code Playgroud)

在本地渲染图表模板并显示输出.

这不需要分蘖.但是,通常在群集中查找或检索的任何值都将在本地伪造.此外,没有完成对图表有效性的服务器端测试(例如,是否支持API).

更多信息:https://docs.helm.sh/helm/#helm-template

  • 错误:stat incubator / kafka:没有这样的文件或目录。 (2认同)

小智 11

直接从 helm install --help

To check the generated manifests of a release without installing the chart,
the '--debug' and '--dry-run' flags can be combined. This will still require a
round-trip to the Tiller server.
Run Code Online (Sandbox Code Playgroud)


neo*_*yle 5

Amrit Bera的解决方案仅适用于本地头盔图,根据您希望它与远程头盔图一起使用的问题的详细信息,该功能将添加到Helm v3(当前在进行中)中。

RehanSaeed发布了以下解决方法(https://github.com/helm/helm/issues/4527

基本上:

mkdir yamls
helm fetch --untar --untardir . 'stable/redis' #makes a directory called redis 
helm template --output-dir './yamls' './redis' #redis dir (local helm chart), export to yamls dir
Run Code Online (Sandbox Code Playgroud)

这样做的好处是,您可以将此技术与git ops的weaveworks助焊剂混合使用+这为您提供了另一种使用不带分er的Helm v2的选择,此外还有分T插件(它使您可以在本地运行分er,但无法顺利运行) )。