我目前正在为K8s在Vault上做一个K8s,但是在一个示例应用程序中我遇到了一些问题。我创建了一个与角色关联的服务帐户,该帐户随后与允许服务帐户读取机密的策略相关联。
我已经创建了一个秘密的basic-secret,我正在尝试将它注入到我的示例应用程序中。然后,应用程序与服务帐户相关联。下面可以看到部署示例应用程序(Hello )和服务帐户的代码:
apiVersion: apps/v1
kind: Deployment
metadata:
name: basic-secret
labels:
app: basic-secret
spec:
selector:
matchLabels:
app: basic-secret
replicas: 1
template:
metadata:
annotations:
vault.hashicorp.com/agent-inject: "true"
vault.hashicorp.com/tls-skip-verify: "true"
vault.hashicorp.com/agent-inject-secret-helloworld: "secret/basic-secret/helloworld"
vault.hashicorp.com/agent-inject-template-helloworld: |
{{- with secret "secret/basic-secret/helloworld" -}}
{
"username" : "{{ .Data.username }}",
"password" : "{{ .Data.password }}"
}
{{- end }}
vault.hashicorp.com/role: "basic-secret-role"
labels:
app: basic-secret
spec:
serviceAccountName: basic-secret
containers:
- name: app
image: jweissig/app:0.0.1
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: basic-secret
labels:
app: basic-secret当我描述部署的pod (kubectl describe pod basic-secret-7d6777cdb8-tlfsw -n vault)时,我得到:

此外,对于日志(kubectl logs pods/basic-secret-7d6777cdb8-tlfsw vault-agent -n vault),我得到:
来自服务器的
错误(BadRequest):容器“储藏室-代理”中的“基本秘密-7d6777cdb8-tlfsw”正在等待启动: PodInitializing
我不知道为什么地下室不初始化。如果有人知道什么是可能的问题,我会非常感激!
最好的威廉。
发布于 2022-10-04 00:17:11
使用kubectl日志荚/basic- (secret/basic-secret/helloworld)?
但是,让我们看看那些代理-init日志
https://stackoverflow.com/questions/73539664
复制相似问题