配置 Grafana Mimir 允许 Vault Agent 向 Pods 注入证书和密钥
启用此功能后,Helm 会更新所有具有 TLS(传输层安全)可配置组件的 Pod 上的注解。部署 Mimir 或 GEM 时,Vault Agent 会根据注解从 Vault 中获取相关的密钥,并将其挂载到 Pod 中。
注意:Vault 和 Vault Agent 必须已经运行。
示例 values.yaml
文件
vaultAgent:
enabled: true
roleName: "test-role"
clientCertPath: "client/cert/path"
clientKeyPath: "client/key/path"
serverCertPath: "server/cert/path"
serverKeyPath: "server/key/path"
caCertPath: "ca/cert/path"
基于上述示例生成的 Kubernetes Deployment YAML 文件
apiVersion: apps/v1
kind: Deployment
metadata:
name: release-name
labels:
helm.sh/chart: mimir-release-1.2.3
app.kubernetes.io/name: mimir
app.kubernetes.io/instance: release-name
app.kubernetes.io/component: comonent-name
app.kubernetes.io/version: "123"
app.kubernetes.io/managed-by: Helm
annotations: {}
namespace: "default"
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: mimir
app.kubernetes.io/instance: release-name
app.kubernetes.io/component: component-name
strategy:
type: RollingUpdate
template:
metadata:
annotations:
vault.hashicorp.com/agent-inject: "true"
vault.hashicorp.com/role: "test-role"
vault.hashicorp.com/agent-inject-secret-client.crt: "client/cert/path"
vault.hashicorp.com/agent-inject-secret-client.key: "client/key/path"
vault.hashicorp.com/agent-inject-secret-server.crt: "server/cert/path"
vault.hashicorp.com/agent-inject-secret-server.key: "server/key/path"
vault.hashicorp.com/agent-inject-secret-root.crt: "ca/cert/path"
vault.hashicorp.com/agent-inject-secret-<FILENAME>: '<PATH>'
告诉 Vault Agent 密钥的位置以及写入密钥的文件名。例如:vault.hashicorp.com/agent-inject-secret-client.crt: 'client/cert/path'
将在 Vault 中查找路径为 client/cert/path
的密钥,并将其作为 client.crt
挂载到 Pod 的 /vault/secrets/
目录中。
有关 Vault 和 Vault Agent 的更多信息,请参阅通过 Sidecar 向 Kubernetes Pod 注入 Vault 密钥。
要配置 Mimir 中的 TLS,请参阅使用 TLS 保护 Grafana Mimir 通信。