代码之家  ›  专栏  ›  技术社区  ›  j9dy

helm本地导出yaml文件(只使用模板引擎,不发送到kubernetes)

  •  8
  • j9dy  · 技术社区  · 7 年前

    我想出口 已模板化 头盔图表作为yaml文件。目前我不能在我的Kubernetes集群上使用Tiller,但我仍然想使用头盔图表。基本上,我希望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)。

    3 回复  |  直到 7 年前
        1
  •  17
  •   Amrit    6 年前

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

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

    helm template mychart
    

    在本地呈现图表模板并显示输出。

    这不需要舵柄。但是,通常 在集群中被查找或检索将被本地伪造。 此外,没有服务器端的图表有效性测试(例如 是否支持API)已完成。

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

        2
  •  3
  •   neoakris    6 年前

    AMRIT BERA的解决方案将只与本地头盔图表一起工作,根据您希望它与远程头盔图表一起工作的问题的详细信息,这是一个将添加到头盔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
    

    这方面的好处是,您可以将此技术与Git Ops+的weaveworks flux结合使用,这为您提供了另一个不使用舵柄的helm v2选项,以及舵柄插件(它允许您在本地运行舵柄,但不能顺利工作)。

        3
  •  2
  •   quant    6 年前

    直接从 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.