【问题标题】:How to correctly mount configMap with subPath in Kubernetes? Not update configs after changes如何在 Kubernetes 中使用 subPath 正确挂载 configMap?更改后不更新配置
【发布时间】:2018-02-01 11:10:48
【问题描述】:

我尝试使用 configMap 在子目录中挂载一些配置。例如:

spec.template.spec.containers.[0].volumeMounts:
  - name: fh16-volume
    mountPath: /etc/fh-16/application.log
    subPath: my-config.txt
spec.template.spec.volumes:
  - name: fh16-volume
    configMap:
      name: my-config

在这种情况下,所有安装都按预期进行。但是在 configMap 发生任何更改后,此更改不会应用到容器中。需要为此重新创建 pod。

它看起来像一些错误,但也许我在配置中犯了一些错误?在我不使用 subPath 指令的情况下,一切都按预期工作。

【问题讨论】:

    标签: kubernetes


    【解决方案1】:

    Kubernetes docs中查看此说明:

    注意:使用 ConfigMap 作为 subPath 卷挂载的容器将不会收到 ConfigMap 更新。"

    【讨论】:

      【解决方案2】:

      【讨论】:

        【解决方案3】:

        这是当前预期的行为。 kubelet 在计时器上更新容器内的内容。

        https://github.com/kubernetes/kubernetes/issues/30189

        【讨论】:

          猜你喜欢
          • 2018-12-20
          • 2019-02-10
          • 2020-03-25
          • 2018-02-21
          • 1970-01-01
          • 1970-01-01
          • 2020-09-30
          • 1970-01-01
          • 2020-02-25
          相关资源
          最近更新 更多