kubernetes 上的多个秘密

Multiple secrets on kubernetes

为单个 Kubernetes 部署管理 3 或 4 个机密的最佳实践。

我们有一个部署,其中一些秘密在所有命名空间中重复,而其他秘密则特定于环境。

我们正在尝试在一个秘密文件和仅更改需要的文件之间做出决定,或者 运行 2+ 个秘密,其中一个是 foo-dev-secrets,另一个是 foo-universal-secrets .

我们找不到任何关于在这些情况下应该做什么的示例,更具体地说是如何管理这些机密,我们知道您只能有 "one secret per volume",但老实说,我们不确定是什么那意味着。

请随意回应,就好像我们是哑巴一样children。 ^_^

running 2+ secrets where one is foo-dev-secrets and the other is foo-universal-secrets

作为 for-your-consideration,well-constructed RBAC 策略将确保只有具有正确权限的帐户才能在机密被分解时读取机密,这(当然)会更难如果它们都集中在一个 "all-the-secrets" 桶中

we know you can only have "one secret per volume", but in all honesty we aren't sure what that means.

那你是个好伙伴,因为我也不知道那是什么意思:-D 如果你的意思是有全局机密,但开发机密的名称相同但更具体,我 think docker -v 会容忍:

containers:
- name: foo
  volumeMounts:
  - name: global-secrets
    mountPoint: /run/secrets/global
    readOnly: true
  - name: foo-secret-override
    mountPoint: /run/secrets/global/no-really
    readOnly: true

...缺点是您的 volumes:volumeMounts: 会变得很健谈

就是说,我敢打赌更通用,更少 mind-bend-y 解决方案是将它们安装为对等体,然后执行相当于 find /run/secrets/ -not -type d 的应用程序将它们全部吞噬:

  volumeMounts:
  - name: global-secrets
    mountPoint: /run/secrets/0-global
    readOnly: true
  - name: foo-secrets
    mountPoint: /run/secrets/1-foo
    readOnly: true

或者,如果可能的话,让应用程序从环境变量或 ConfigMap-ed 情况下读取路径,这意味着可以将它们投影为对等(仍然)但 point-out 到应用程序它应该使用的两个值中的一个。

当然,细节决定成败,所以如果您能够分享您遇到的障碍的更多细节,请随时插话