【发布时间】:2022-03-07 13:02:58
【问题描述】:
Azure Keyvault + SecretProviderClass + imagePullSecrets+ Private docker repository 组合如何配置部署文件。
我们有私有 Docker 存储库来维护映像,现在我们需要在 Azure 密钥库中维护该 Docker 存储库的凭据,使用 SecretProviderClass 将其导入 AKS,在“imagePullSecrets”下使用该密钥
# This is a SecretProviderClass example using system-assigned identity to access your key vault
apiVersion: secrets-store.csi.x-k8s.io/v1
kind: SecretProviderClass
metadata:
name: azure-kvname-system-harbor
spec:
provider: azure
secretObjects:
- secretName: harborcredentialvault
data:
- key: harborcredentialvaultkey
objectName: harborcredentialvault
type: kubernetes.io/dockerconfigjson
parameters:
usePodIdentity: "false"
useVMManagedIdentity: "true" # Set to true for using managed identity
userAssignedIdentityID: "" # If empty, then defaults to use the system assigned identity on the VM
keyvaultName: "<Keyvault name>"
cloudName: "" # [OPTIONAL for Azure] if not provided, the Azure environment defaults to AzurePublicCloud
objects: |
array:
- |
objectName: harborcredentialvault
objectType: secret # object types: secret, key, or cert
objectVersion: "" # [OPTIONAL] object versions, default to latest if empty
tenantId: "<tenant ID>" # The tenant ID of the key vault
- name: harborcredentialvault
valueFrom:
secretKeyRef:
name: keyvault-secret
key: harborcredentialvaultkey
imagePullSecrets:
- name: ${harborcredentialvault}
volumeMounts:
- mountPath: "/mnt/secrets-store"
name: secrets-store01-inline
readOnly: true
- name: secrets-store01-inline
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
secretProviderClass: "azure-kvname-system-harbor"
【问题讨论】:
-
您的私有注册表是 Azure 容器注册表吗?或者你可以转而使用它吗?因为那样您就可以使用 AKS 托管身份对其进行身份验证
-
它似乎是它的 Harbor,而不是配置中的 ACR。
标签: azure yaml azure-aks azure-keyvault harbor