问题标签 [kustomize]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
1688 浏览

merge - 有没有办法在 yaml 文件中制作 kustomize 合并标题,而不是用覆盖 yaml 完全替换该标题

我有一个基本 yaml 和一个覆盖 yaml,并使用“kustomize”我想合并这两个 yaml。发生在我身上的是,在运行 kustomize build 时会出现一个输出,但预计不会是为什么?因为在我的例子中,kustomize 不是从覆盖 yaml 填充自定义信息,而是用覆盖“容器”替换了基础的整个标题标签。我需要的预期行为是它应该以某种方式使用覆盖 yaml 而不是替换来填充缺失的信息。

基础yaml:

覆盖yaml:

kustomize 构建后的预期结果:

我得到了什么:

0 投票
1 回答
5566 浏览

kubernetes - 新 kubernetes kustomize 支持中的变量替换(自 1.14.0 起):kubectl apply -k ./

我们以这种方式将 kustomize 用于我们的 kubernetes 部署:

并部署此 yaml 用 1.7.9 替换变量 IMAGE_VERSION

由于 kubectl 1.14 支持 kustomize。

现在我们可以像这样做一些非常好的事情

但是如何用这个新命令替换 IMAGE_VERSION 变量?

0 投票
1 回答
1636 浏览

kubernetes - 有没有办法使用 Kustomize 添加新资源(而不是覆盖它们)?

使用kubectl apply -k,您可以覆盖资源配置(您已经定义)。你也能创造资源吗?

在我的具体情况下,我想为开发环境创建一个本地卷。我在基本文件夹中没有这个资源。

我的文件夹结构是这样的:

0 投票
1 回答
2868 浏览

kubernetes - Kubernetes 部署缺少 Kustomize 的哈希后缀

我是 Kubernetes 新手。在我的项目中,我尝试使用 Kustomize 为我的部署生成 configMaps。Kustomize 在 configMap 名称后添加了一个哈希,但我无法让它也更改部署以使用该新的 configMap 名称。

部署:

kustomize.yml:

然后我运行 kustomize,应用部署并检查它是否应用了环境。

但它仍然从以下位置获取环境变量:env-receiver-config,而不是env-receiver-config-258g858mgg

我当前的解决方法是禁用kustomize.yml.

看起来我缺少一个步骤来告诉部署新 configMap 的名称。它是什么?

0 投票
2 回答
1036 浏览

kubernetes - kubernetes - ConfigMap 挂载到单个文件中

我正在尝试在 kubernetes 部署期间使用 configmap 挂载文件。我将我的应用程序属性作为配置映射中的数据。我正在使用kustomize. Kustomize 将有助于合并两个配置图。当我构建kustomize它时,它会返回 configmap

当我挂载这个配置映射时,它会创建两个不同的文件。但我想合并到一个文件中。我的应用程序服务器将需要一个属性文件。有人可以解决这个问题吗?

0 投票
1 回答
352 浏览

kubernetes - Is kustomize for k8s backward chaining?

The README for kustomize says that

It's like make, in that what it does is declared in a file, and it's like sed, in that it emits edited text.

Does this analogy extend beyond the fact that files are used to declare what is needed?

Or, is kustomize backward chaining like make in that it reads all command input before working out what it has to do rather than work sequentially and step through the command input like bash working through a shell script?

EDIT: Jeff Regan, of the Kustomize team in Google, explains the model for the way kustomize works towards the beginning of his talk Kustomize: Kubernetes Configuration Customization. He also shows how kustomize may be daisy chained so the output of one kustomize may serve as the input to another kustomize. It seems that, as pointed out by ITChap below, kustomize starts by gathering all the resources referenced in the kustomization.yml file in the base dir. It the executes sequentially in a series of steps to perform the required substitutions and transformations interatively. Repeating the substitution/tranformation step as often as needed to complete. It then spits out the generated YAML on stdout. So I would say that it is not backward chaining like make but rather somewhere in between. HTH.

0 投票
0 回答
2087 浏览

kubernetes - 在 kustomize 中重用 JSON 补丁

我在我的覆盖 kustomization 文件中使用 JSON 补丁,以便设置要用于我的 pod 的图像。

补丁本身非常通用:

在我的kustomization.yml

通过使用这种方法,我必须为使用不同映像的每个部署使用不同的补丁。有没有办法将补丁value字段移动到kustomization.yml文件中,我可以在其中执行以下操作:

0 投票
1 回答
331 浏览

kubernetes - 从 Kustomize 中的文本文件目录创建每个文件的 Kubernetes 机密

我有许多想要进入 Kubernetes 集群的秘密“环境变量”。目前,我有一个包含这些秘密的目录,其中每个 var 都有一个对应的文件,其名称与应该分配给的变量相同。使用docker-compose,这给了我一个像for secret in .secrets/*; do export "$(basename $secret)"="$(cat $secret)" ; done

我希望避免在 kustomize 文件中明确指定这些秘密中的每一个。有没有一种简单的方法可以通过仅指定目录来为每个文件创建一个秘密?

0 投票
1 回答
1386 浏览

kubernetes - kustomize configmap 命令:它有什么作用?

我是 kubernetes 的新手,我正在到处学习一些教程。我正在努力理解不同的组件和工具,其中之一就是 kustomize。我看到了不同的 kustomize 用法示例,但我不理解其中的一个(即使在网上搜索后也是如此)。那么您能向我解释一下以下kustomize命令的功能吗:

0 投票
1 回答
2451 浏览

kubernetes - kustomize 环境源文件中的多行值

我正在尝试将多行值(ca 证书文件的内容)设置为特定密钥的 kustomize 环境文件,如下面的代码所示。有没有办法做到这一点?

注意:向 some_params.env 中的值添加引号不起作用。

自定义.yaml

some_params.yaml

some_params.env

运行以下命令: kustomize build base

回报: Error: NewResMapFromConfigMapArgs: NewResMapFromConfigMapArgs: env source file: some_params.env: "-----BEGIN CERTIFICATE-----" is not a valid key name: a valid environment variable name must consist of alphabetic characters, digits, '_', '-', or '.', and must not start with a digit (e.g. 'my.env-name', or 'MY_ENV.NAME', or 'MyEnvName1', regex used for validation is '[-._a-zA-Z][-._a-zA-Z0-9]*')