我想把已经模板化的Helm图表导出为YAML文件。我现在不能在我的Kubernetes集群上使用Tiller,但是我仍然想使用Helm图表。基本上,我想让Helm导出YAML,然后把它发送到Kubernetes API,其中的值是Helm模板化的。之后,我会把YAML文件上传到我的Kubernetes集群。
我尝试运行.\helm.exe install --debug --dry-run incubator\kafka
,但得到错误Error: Unauthorized
。
请注意,我在Windows上运行Helm(版本helm-v2.9.1-windows-amd 64)。
5条答案
按热度按时间6rvt4ljy1#
我们需要日志来检查
Unauthorized
问题。但是您可以轻松地在本地生成模板:
在本地呈现图表模板并显示输出。
这不需要Tiller。但是,通常在集群中查找或检索的任何值都将在本地伪造。此外,不会进行任何服务器端的图表有效性测试(例如,是否支持API)。
更多信息:https://helm.sh/docs/helm/helm_template/
ccrfmcuu2#
Amrit Bera的解决方案将只与本地舵图工作,根据您的问题的细节,你希望它与远程舵图工作,这是一个功能,将被添加到Helm v3(目前正在进行中).
RehanSaeed发布了以下解决方法(https://github.com/helm/helm/issues/4527)
基本上:
好的一面是你可以把这个技术和weaveworks flux结合起来使用git ops +,这给了你另一个选择,除了Tiller插件(它可以让你在本地运行Tiller,但是运行起来不太流畅)之外,你还可以使用没有Tiller的Helm v2。
yizd12fk3#
直接从
helm install --help
4si2a6ki4#
If you want to see only the resolved YAML you can use
I prefer to see it on a file
ukqbszuj5#
This is not the answer for the question but this post on stackoverflow is the first one which was displayed in searchengines when i was searching for a solution of my problem and solved it by myself reading the Helm CLI docs. I post it here anyway because maybe someone else is searching for the same usecase as i did.
For already installed Helm charts on a Kubernetes cluster you can use the following command to export/download all information for a named release:
or
If you only want e.g. the
manifests
orvalues
instead of all, just replace theall
command appropriately (get more details by usinghelm get --help
):If you want to export the information for a named release with a distinct revision you can use the flag
--revision int
in your get command (helm get all --help
). To list all possible revisions of your named release just use the commandhelm history <release-name>
.My Helm CLI version:
version.BuildInfo{Version:"v3.5.0", GitCommit:"32c22239423b3b4ba6706d450bd044baffdcf9e6", GitTreeState:"clean", GoVersion:"go1.15.6"}