我们正在为数据库创建 secret 并将它们作为卷安装到 POD,但是当我们更新 pod 时,不会刷新以获取新的更改。但文档说它会自动刷新
https://kubernetes.io/docs/concepts/configuration/secret/
我们在这里遗漏了什么吗?它是否需要代码端的任何特定逻辑。
提前致谢
最佳答案
Kubernetes 本身目前不支持此功能,并且正在开发该功能 ( https://github.com/kubernetes/kubernetes/issues/22368 )。
您可以使用可用的自定义解决方案来实现相同的目的,其中流行的解决方案包括 Reloader
.
您链接的文档描述了当您更新 Kubernetes Secret
对象时,已安装卷内的 secret 值将会更新。 pod 内运行的应用程序在更新 key 后需要重新读取 key ,并且在更新 key 本身时不会创建新的 pod。
另请注意,实际更新 key 与将这些值反射(reflect)在卷中之间可能存在一些延迟。
As a result, the total delay from the moment when the Secret is updated to the moment when new keys are projected to the Pod can be as long as the kubelet sync period + cache propagation delay, where the cache propagation delay depends on the chosen cache type (it equals to watch propagation delay, ttl of cache, or zero correspondingly)
关于kubernetes - 当安装的 secret 更新时自动刷新 POD,但它看起来没有发生,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66114715/