Skip to main content

Reloader一个 Kubernetes Controller, 用于监视 ConfigMap 和 Secret 的变更,并对关联的 Deployment、StatefulSet、DaemonSet 和 DeploymentConfig 执行滚动升级

  1. Reloader

    一个 Kubernetes Controller, 用于监视 ConfigMap 和 Secret 的变更,并对关联的 Deployment、StatefulSet、DaemonSet 和 DeploymentConfig 执行滚动升级。

    https://github.com/stakater/Reloader

    监视 ConfigMap 和 Secret 的变更
    对关联的 Deployment、StatefulSet、DaemonSet 和 DeploymentConfig 执行滚动升级
    支持 Sealed Secrets
    支持多种滚动升级策略,如 env-vars 和 annotations

    如何使用 Reloader:

    首先,确保你的 Kubernetes 版本 >= 1.19。接下来,通过添加相应的注解到资源的 metadata 中即可使用。例如,如果你有一个 Deploymentfoo,并且有一个 ConfigMapSecret(例如 foo-configmapfoo-secret),只需在 Deploymentmetadata 中添加如下注解:

    kind: Deployment
    metadata:
      name: foo
      annotations:
        reloader.stakater.com/auto: "true"

    这样,当 foo-configmapfoo-secret 发生变化时,Reloader 就会自动触发滚动更新。

    对于特定的 ConfigMapSecret 触发滚动更新,可以使用以下注解:

    kind: Deployment
    metadata:
      annotations:
        configmap.reloader.stakater.com/reload: "foo-configmap"
        secret.reloader.stakater.com/reload: "foo-secret"

    此外,Reloader 还支持通过设置 --auto-reload-all 标志来启用对所有资源的自动重载。

    #DevOps #K8s #GitHub GitHub - stakater/Reloader: A Kubernetes controller to watch changes in ConfigMap and Secrets and do rolling upgrades on Pods with…
OKHK