覆盖物中的补丁容器

发布于 2025-01-28 16:45:33 字数 272 浏览 2 评论 0原文

我有用案例在环境上添加一些库(代理)基础,

├───k8s
│   ├───base
│   ├───modules
│   │   └───someagent
│   └───overlays
│       └───local

该代理基本上是一个容器,它将与我在基地中定义的主容器进行通信。

有人可以建议如何在kustomization.yaml中定义本地吗?我已经尝试了PatchSstrategicmerge,但它不起作用。

谢谢

I have use case to add some library (agent) base on the environment

├───k8s
│   ├───base
│   ├───modules
│   │   └───someagent
│   └───overlays
│       └───local

This agent basically is a container that will communicate with the main container that I define in the base.

Can someone advice how to define in kustomization.yaml in local? I have tried with patchesStrategicMerge, but it doesn't work.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烟凡古楼 2025-02-04 16:45:33

据我了解,您正在尝试将第二个(Sidecar)容器添加到现有吊舱中。由于运行独立豆荚非常罕见,我会为部署提供一个示例补丁,但可以很容易地更改为其他类型:

patches:
  - target:
      kind: Deployment
      name: myDeploymend
    patch: |-
      - op: add
        path: /spec/template/spec/containers/-
        value:
          # Put your container definition here. For example:
          name: myAgent
          image: ...
          command: ...
          args: ...
          env: ...

From what I understand, you are trying to add a second (sidecar) container to an existing Pod. Since it's pretty rare to run standalone Pods I will give an example patch for a deployment but it can easily be changed to other Kinds:

patches:
  - target:
      kind: Deployment
      name: myDeploymend
    patch: |-
      - op: add
        path: /spec/template/spec/containers/-
        value:
          # Put your container definition here. For example:
          name: myAgent
          image: ...
          command: ...
          args: ...
          env: ...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文