[英]Override values.yaml in helm chart using nexus
Helm Chart Structure掌舵图结构
web-service
|_ _ _ templates
|_ _ _ Chart.yaml
|_ _ _ values.yaml
I have helm chart setup in which my helm charts for my application are packaged .tgz
and pushed to nexus repo consider https://localhost:50714/#browse/browse:helm
我有舵图设置,其中我的应用程序的舵图被打包为
.tgz
并推送到 nexus 存储库,请考虑https://localhost:50714/#browse/browse:helm
Which is added to helm repositories.yaml
using使用以下命令将其添加到 helm
repositories.yaml
中
helm repo add nexus https://localhost:50714/
Once Repo is added I can see the chart添加 Repo 后,我可以看到图表
helm search
NAME CHART VERSION APP VERSION DESCRIPTION
nexus/web-service 1.0.0-k8s Custom microservice Helm chart
To Install I Fire the below command要安装我触发以下命令
helm install nexus/ioc-web-service --version 1.0.0-k8s
and application get deployed.和应用程序得到部署。 So the application is deployed using default values.yaml I need to make this configurable so that my default values.yaml is overridden by another file lets say values-override.yaml
所以应用程序是使用 default values.yaml 部署的,我需要进行配置,以便我的默认 values.yaml 被另一个文件覆盖
web-service
|_ _ _ templates
|_ _ _ Chart.yaml
|_ _ _ values.yaml
|_ _ _ values-override.yaml
I used helm provision of passing extra file using -f
command but it gives values-override.yaml
file not found我使用 helm 提供了使用
-f
命令传递额外文件的功能,但它提供了未找到的values-override.yaml
文件
helm install nexus/web-service -f values-override.yaml --version 1.0.0-k8s
Need Some input on how to get the pass the override values in file format.需要一些关于如何以文件格式获取传递覆盖值的输入。 As the override values can be dynamic.
因为覆盖值可以是动态的。 On one environment it can be 1 variable in another there are be 10 variable which needs to be overridden
在一个环境中,它可以是 1 个变量,而在另一个环境中,有 10 个变量需要被覆盖
You do not add the values-overwrite.yaml
in the chart.您没有在图表中添加
values-overwrite.yaml
。 Its a file locally where you run the command.它是您在本地运行命令的文件。 Usually created by a templating taskrunner engine like Ansible or similar on the fly.
通常由模板 taskrunner 引擎(如 Ansible 或类似的)动态创建。
Here are the docs for Customizing the Chart Before Installing and you can use two ways of passing config data during installation:以下是安装前自定义图表的文档,您可以在安装期间使用两种传递配置数据的方法:
--values
(or-f
): Specify a YAML file with overrides.--values
(或-f
):指定带有覆盖的 YAML 文件。 This can be specified multiple times and the rightmost file will take precedence这可以指定多次,最右边的文件将优先
--set
: Specify overrides on the command line.--set
:在命令行上指定覆盖。
You have to remember you need to run helm install
from the directory where your YAML
file is sitting.您必须记住,您需要从
YAML
文件所在的目录运行helm install
。
If you are still seeing the Error: open values-override.yaml: no such file or directory
, this means that Helm
is probably installed as a docker container.如果您仍然看到
Error: open values-override.yaml: no such file or directory
,这意味着Helm
可能安装为 docker 容器。 This happens if you use Kubespray
to install Helm
in this case can should check which folder is being mounted to the docker by: $ cat /usr/local/bin/helm
You might see something like this:如果您使用
Kubespray
安装Helm
会发生这种情况,在这种情况下可以通过以下方式检查哪个文件夹正在安装到 docker: $ cat /usr/local/bin/helm
您可能会看到如下内容:
cat /usr/local/bin/helm
#!/bin/bash
/usr/bin/docker run --rm \
--net=host \
--name=helm \
-v /etc/ssl:/etc/ssl:ro \
-v /root/.helm:/root/.helm:rw \
-v /usr/share/ca-certificates:/usr/share/ca-certificates:ro \
lachlanevenson/k8s-helm:2.7.0 \
"$@"
Which will mean you need to copy values-override.yaml
to /root/.helm
directory.这意味着您需要将
values-override.yaml
复制到/root/.helm
目录。 You can also check the directory by $ helm init
:您还可以通过
$ helm init
检查目录:
$ helm init
$HELM_HOME has been configured at /root/.helm.
Warning: Tiller is already installed in the cluster.
(Use --client-only to suppress this message, or --upgrade to upgrade Tiller to the current version.)
Happy Helming!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.