来自 k8s configmap 的动态特使配置
dynamic envoy configuration from k8s configmap
我尝试按照以下示例在我的 kubernetes 集群中配置特使:https://www.envoyproxy.io/docs/envoy/latest/start/quick-start/configuration-dynamic-filesystem
我的静态特使配置:
node:
cluster: test-cluster
id: test-id
dynamic_resources:
cds_config:
path: /var/lib/envoy/cds.yaml
lds_config:
path: /var/lib/envoy/lds.yaml
admin:
access_log_path: "/dev/null"
address:
socket_address:
address: 0.0.0.0
port_value: 19000
来自 configmap 的动态配置已挂载并包含文件 .
我使用 configmap 将配置文件(cds.yaml
和 lds.yaml
)挂载到 envoy pod(到 /var/lib/envoy/
),但不幸的是当我安装时 envoy 配置没有改变更改 configmap 中的配置。已安装的配置文件按预期更新。
我可以从日志中看到,特使监视配置文件:
[2021-03-01 17:50:21.063][1][debug][file] [source/common/filesystem/inotify/watcher_impl.cc:47] added watch for directory: '/var/lib/envoy' file: 'cds.yaml' fd: 1
[2021-03-01 17:50:21.063][1][debug][upstream] [source/common/upstream/cluster_manager_impl.cc:140] maybe finish initialize state: 1
[2021-03-01 17:50:21.063][1][debug][upstream] [source/common/upstream/cluster_manager_impl.cc:149] maybe finish initialize primary init clusters empty: true
[2021-03-01 17:50:21.063][1][info][config] [source/server/configuration_impl.cc:95] loading 0 listener(s)
[2021-03-01 17:50:21.063][1][info][config] [source/server/configuration_impl.cc:107] loading stats configuration
[2021-03-01 17:50:21.063][1][debug][file] [source/common/filesystem/inotify/watcher_impl.cc:47] added watch for directory: '/var/lib/envoy' file: 'lds.yaml' fd: 1
一旦我更新了配置映射,我也会得到一些改变的日志:
[2021-03-01 17:51:50.881][1][debug][file] [source/common/filesystem/inotify/watcher_impl.cc:72] notification: fd: 1 mask: 80 file: ..data
[2021-03-01 17:51:50.881][1][debug][file] [source/common/filesystem/inotify/watcher_impl.cc:72] notification: fd: 1 mask: 80 file: ..data
但 envoy 不会重新加载配置。
看来kubernetes是通过改变目录来更新配置文件的,而envoy并没有识别出配置文件被改变了。
有没有简单的方法可以解决这个问题?我不想 运行 和 xDS 服务器用于我的测试,但热配置重新加载对我的测试非常有用
谢谢!
我认为您的问题的答案是 Envoy 用于重新加载其 xDS 配置的文件系统事件不是由 configmap 卷触发的。 See more explanation in the README for the crossover utility.
我尝试按照以下示例在我的 kubernetes 集群中配置特使:https://www.envoyproxy.io/docs/envoy/latest/start/quick-start/configuration-dynamic-filesystem
我的静态特使配置:
node:
cluster: test-cluster
id: test-id
dynamic_resources:
cds_config:
path: /var/lib/envoy/cds.yaml
lds_config:
path: /var/lib/envoy/lds.yaml
admin:
access_log_path: "/dev/null"
address:
socket_address:
address: 0.0.0.0
port_value: 19000
来自 configmap 的动态配置已挂载并包含文件 .
我使用 configmap 将配置文件(cds.yaml
和 lds.yaml
)挂载到 envoy pod(到 /var/lib/envoy/
),但不幸的是当我安装时 envoy 配置没有改变更改 configmap 中的配置。已安装的配置文件按预期更新。
我可以从日志中看到,特使监视配置文件:
[2021-03-01 17:50:21.063][1][debug][file] [source/common/filesystem/inotify/watcher_impl.cc:47] added watch for directory: '/var/lib/envoy' file: 'cds.yaml' fd: 1
[2021-03-01 17:50:21.063][1][debug][upstream] [source/common/upstream/cluster_manager_impl.cc:140] maybe finish initialize state: 1
[2021-03-01 17:50:21.063][1][debug][upstream] [source/common/upstream/cluster_manager_impl.cc:149] maybe finish initialize primary init clusters empty: true
[2021-03-01 17:50:21.063][1][info][config] [source/server/configuration_impl.cc:95] loading 0 listener(s)
[2021-03-01 17:50:21.063][1][info][config] [source/server/configuration_impl.cc:107] loading stats configuration
[2021-03-01 17:50:21.063][1][debug][file] [source/common/filesystem/inotify/watcher_impl.cc:47] added watch for directory: '/var/lib/envoy' file: 'lds.yaml' fd: 1
一旦我更新了配置映射,我也会得到一些改变的日志:
[2021-03-01 17:51:50.881][1][debug][file] [source/common/filesystem/inotify/watcher_impl.cc:72] notification: fd: 1 mask: 80 file: ..data
[2021-03-01 17:51:50.881][1][debug][file] [source/common/filesystem/inotify/watcher_impl.cc:72] notification: fd: 1 mask: 80 file: ..data
但 envoy 不会重新加载配置。
看来kubernetes是通过改变目录来更新配置文件的,而envoy并没有识别出配置文件被改变了。
有没有简单的方法可以解决这个问题?我不想 运行 和 xDS 服务器用于我的测试,但热配置重新加载对我的测试非常有用
谢谢!
我认为您的问题的答案是 Envoy 用于重新加载其 xDS 配置的文件系统事件不是由 configmap 卷触发的。 See more explanation in the README for the crossover utility.