【发布时间】:2020-11-04 12:16:59
【问题描述】:
无法使用以下设置读取存储在 Vault 中路径 /secrets/apims/ABC_CONFIG 的机密
在保险柜中创建的策略:
vault policy write policy_name - <<EOF
path "secret/apims/*" {
capabilities = ["read"]
}
在 Vault 中创建的角色
vault write auth/kubernetes/role/role_name\
bound_service_account_names=service_account_name \
bound_service_account_namespaces=default \
policies=policy_name \
ttl=24h
在外部保险库上使用 Kubernetes 保险库边车注入器。 Kubernetes 上的部署是这样的
apiVersion: "apps/v1"
kind: "Deployment"
metadata:
name: "nginx-5"
namespace: "default"
labels:
app: "nginx-5"
spec:
replicas: 1
selector:
matchLabels:
app: "nginx-5"
template:
metadata:
annotations:
vault.hashicorp.com/agent-inject: "true"
vault.hashicorp.com/agent-inject-secret-credentials.conf: secret/ABC_CONFIG
vault.hashicorp.com/role: role_name
labels:
app: "nginx-5"
spec:
containers:
- name: "nginx-5"
image: "nginx:latest"
serviceAccountName: service_account_name
虽然 Kubernetes 已通过 Vault 成功授权,但读取特定密钥失败并出现 403。
感谢您的帮助。
【问题讨论】:
标签: kubernetes google-kubernetes-engine hashicorp-vault