Kai*_*kar 3 azure kubernetes csi azure-aks
通过使用https://learn.microsoft.com/en-us/azure/aks/csi-secrets-store-nginx-tls本文档的参考,我尝试将 TLS 机密从 AKV 获取到 AKS pod。最初,我使用用户分配的托管身份创建并配置了CSI 驱动程序配置。
我已执行以下步骤:
apiVersion: secrets-store.csi.x-k8s.io/v1
kind: SecretProviderClass
metadata:
name: azure-tls
spec:
provider: azure
secretObjects: # secretObjects defines the desired state of synced K8s secret objects
- secretName: ingress-tls-csi
type: kubernetes.io/tls
data:
- objectName: ingresscert
key: tls.key
- objectName: ingresscert
key: tls.crt
parameters:
usePodIdentity: "false"
useVMManagedIdentity: "true"
userAssignedIdentityID: "7*******-****-****-****-***********1"
keyvaultName: "*****-*****-kv" # the name of the AKV instance
objects: |
array:
- |
objectName: ingresscert
objectType: secret
tenantId: "e*******-****-****-****-***********f" # the tenant ID of the AKV instance
Run Code Online (Sandbox Code Playgroud)
apiVersion: apps/v1
kind: Deployment
metadata:
name: busybox-one
labels:
app: busybox-one
spec:
replicas: 1
selector:
matchLabels:
app: busybox-one
template:
metadata:
labels:
app: busybox-one
spec:
containers:
- name: busybox
image: k8s.gcr.io/e2e-test-images/busybox:1.29-1
command:
- "/bin/sleep"
- "10000"
volumeMounts:
- name: secrets-store-inline
mountPath: "/mnt/secrets-store"
readOnly: true
volumes:
- name: secrets-store-inline
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
secretProviderClass: "azure-tls"
---
apiVersion: v1
kind: Service
metadata:
name: busybox-one
spec:
type: ClusterIP
ports:
- port: 80
selector:
app: busybox-one
Run Code Online (Sandbox Code Playgroud)
kubectl get secret -n <namespaceName>
Run Code Online (Sandbox Code Playgroud)
这里需要注意的一件事是,如果我将 shell 附加到繁忙的盒子 Pod 并转到我提供的用于挂载机密的挂载路径,我会看到机密已成功获取到那里。但这些秘密并没有显示在 AKS 的秘密列表中。
我已对所有 AKS、KV 和清单文件进行了故障排除,但没有找到任何内容。如果我错过了什么或者有人有解决方案,请告诉我。
提前致谢..!!!
我将此添加为新答案,因为评论中的格式很糟糕:
当您使用 Helm Chart 时,您必须激活values.yaml
Helm Chart 中的秘密同步:
secrets-store-csi-driver:
syncSecret:
enabled: true
Run Code Online (Sandbox Code Playgroud)
我仍然建议使用csi-secrets-store-provider-azure
as AKS Addon 而不是 Helm-Chart
归档时间: |
|
查看次数: |
4109 次 |
最近记录: |