我在 Kubernetes 的 Vault 中创建了一个 Secret,而不是使用 K8s API。并且想使用 Vault 中的 Secret 从私有注册表中提取图像。我无法找到这样做的方法。以下是示例代码,假设我使用 Deployment 访问 Vault 的所有标签。
apiVersion: apps/v1
kind: Deployment
metadata:
name: test-app-exporter
namespace: monitoring
spec:
replicas: 1
selector:
matchLabels:
app: test-app-exporter
template:
metadata:
labels:
app: test-app-exporter
spec:
containers:
- name: test-app-exporter
image: index.docker.io/xxxxx/test-app-exporter:3
imagePullPolicy: Always
resources:
limits:
memory: "128Mi"
cpu: "500m"
ports:
- name: http
containerPort: 5000
imagePullSecrets:
- name: [myregistrykey--Secret From Vault]