apisix-helm-chart icon indicating copy to clipboard operation
apisix-helm-chart copied to clipboard

`ConfigMap` cannot refresh by `subPath`

Open anjia0532 opened this issue 3 years ago • 5 comments

en https://kubernetes.io/docs/concepts/storage/volumes/#configmap

A container using a ConfigMap as a subPath volume mount will not receive ConfigMap updates.

Maybe remove subPath is better ? We can use apisix reload without restart deployments/pods ?

e.g. configmap-reload toolkit

configmap-reload is a simple binary to trigger a reload when Kubernetes ConfigMaps are updated. It watches mounted volume dirs and notifies the target process that the config map has been changed. It currently only supports sending an HTTP request, but in future it is expected to support sending OS (e.g. SIGHUP) once Kubernetes supports pod PID namespaces.

中文 https://kubernetes.io/zh/docs/concepts/storage/volumes/#configmap

容器以 subPath 卷挂载方式使用 ConfigMap 时,将无法接收 ConfigMap 的更新。

或许应该去掉 subPath ? 这样如果修改 ConfigMap 后可以通过 apisix reload 命令热加载更新,而不需要重启 apisix 服务?

例如 configmap-reload 小工具

configmap-reload 是一个简单的二进制文件,用于在 Kubernetes ConfigMap 更新时触发重新加载。它监视挂载的卷目录并通知目标进程配置映射已更改。它目前只支持发送一个 HTTP 请求,但未来一旦 Kubernetes 支持 pod PID 命名空间,它有望支持发送 OS(例如 SIGHUP)。

anjia0532 avatar Mar 02 '22 02:03 anjia0532

As per the immutable infrastructure design, I think reloading APISIX inside the pod is not a good idea.

tokers avatar Mar 02 '22 10:03 tokers

@tokers Acknowledge your point of view. But,

  1. nginx -s reload openresty -s reload apisix reload ... They provide that functionality.
  2. ConfigMap provide delayed updates (Except for subPath )
  3. An Apisx instance abnormal restarts unexpectedly after the configuration is modified, Cause inconsistency of Apisix cluster.

Screenshot of WeChat Group chat. image

anjia0532 avatar Mar 03 '22 00:03 anjia0532

APISIX is a dynamic high-performance gateway, one of its main features is dynamism. If there is a scenario where the configuration file needs to be modified, I prefer APISIX to provide this dynamic change capability

tao12345666333 avatar Mar 03 '22 00:03 tao12345666333

APISIX is a dynamic high-performance gateway, one of its main features is dynamism. If there is a scenario where the configuration file needs to be modified, I prefer APISIX to provide this dynamic change capability

Yes, exactly.

tokers avatar Mar 03 '22 01:03 tokers