kubernetes - 当安装的 secret 更新时自动刷新 POD,但它看起来没有发生

标签 kubernetes openshift kubernetes-secrets

我们正在为数据库创建 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/

相关文章:

java - 正在进行的快照太多。增加kafka生产者池的大小或减少并发检查点的数量

kubernetes - 如何为父 Helm 图表指定值

node.js - 为什么 mongodb 在推送到 openshift 后会重置

amazon-web-services - Kubernetes 加密配置

kubernetes - 在同一 namespace 的服务层隔离 secret

kubernetes - kubernetes 上的多个 secret

kubernetes - 如何将 ConfigMap 配置与 Helm NginX Ingress Controller 结合使用 - Kubernetes

java - 在 Openshift 中部署 Vaadin 应用程序

tomcat - 在 tomcat catalina.properties [Kubernetes] 中注入(inject)环境变量

nginx - 如何在Kubernetes中正确运行用户定义的Pod?