使用下面的安装程序无法读取存储在path / below /apims/ABC_CONFIG中的秘密
在Vault制定的政策:
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无法读取特定的密钥。


谢谢你的帮助。
发布于 2020-07-15 04:38:33
看起来,在Vault角色中定义的服务帐户或角色名称都与部署中的角色不匹配。
service_account_name
vault write auth/kubernetes/role/role_name\
bound_service_account_names=service_account_name \
bound_service_account_namespaces=default \
policies=policy_name \
ttl=24hsa-vault-auth
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: apims
labels:
app: "nginx-5"
spec:
containers:
- name: "nginx-5"
image: "nginx:latest"
serviceAccountName: sa-vault-auth
...这也是假设policies=policy_name是您最初在Vault中创建的策略的名称。
https://stackoverflow.com/questions/62907414
复制相似问题