【问题标题】:How to Merge the contents of ConfigMaps in Kubernetes如何在 Kubernetes 中合并 ConfigMaps 的内容
【发布时间】:2019-08-16 06:16:07
【问题描述】:

我们在以下文件中指定了我们的应用特定属性

application.properties
application-dev.properties
application-qa.properties

在 kubernetes 中创建 configmap 时,我想将内容合并到一个文件中。是否可以合并内容?

我知道我们可以通过 kustomize 实现。但是,我们使用的是 Helm Charts 而不是 kustomize。

https://github.com/kubernetes-sigs/kustomize/blob/master/examples/combineConfigs.md

【问题讨论】:

    标签: kubernetes configmap


    【解决方案1】:

    试试这个简单的技巧

    cat application*.properties > app.properties && kubectl create configmap myconfigmap --from-file=app.properties
    

    您可以在 helm chart 中使用 app.properties

    【讨论】:

      【解决方案2】:

      将 ConfigMap 文件放在一个文件夹中,然后将文件夹路径传递给kubectl 命令:

      kubectl create configmap config-name --from-file=path_to_the_folder
      

      关注链接:https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/

      【讨论】:

      • 问题是“我们使用掌舵图”。那不是掌舵。
      猜你喜欢
      • 1970-01-01
      • 2021-04-06
      • 2019-02-02
      • 2018-08-02
      • 1970-01-01
      • 2020-03-09
      • 1970-01-01
      • 2020-05-14
      • 2018-11-21
      相关资源
      最近更新 更多