向卷安装添加机密时 Base64 无效

问题描述 投票:0回答:1

我在 Azure 中有 KeyVault,其中证书和密钥作为机密添加。证书采用

.crt
格式,密钥采用
.key
格式。当尝试在 DevOps 中通过 .yaml 配置部署容器时,我可以从密钥保管库检索机密,但无法将它们包含到卷中。例外情况如下:

 The value of secret 'server.crt' in volume 'app-secrets' is not encoded in valid Base64 format.

.yml 部署文件如下所示:

apiVersion: 2019-12-01
location: westeu
name: abcgroup
properties:
  containers:
  - name: abc
    properties:
      image: abc.azurecr.io/image:latest
      resources:
        requests:
          cpu: 1
          memoryInGb: 1.5
      ports:
      - port: 5000
      volumeMounts:
        - name: 'app-secrets'
          mountPath: '/mnt/secrets'
  osType: Linux
  ipAddress:
    type: Public
    ports:
    - protocol: tcp
      port: 5000
  volumes:
    - name: 'app-secrets'
      secret:
        ca.pem: $(ca-pem)
        server.crt: $(server-crt)
        server.key: $(server-priv-key)
  imageRegistryCredentials:
    - server: abc.azurecr.io
      username: abc
      password: abcd
tags: null
type: Microsoft.ContainerInstance/containerGroups

我尝试上传证书值,包括第一行和最后一行(带有 -----BEGIN CERTIFICATE-----)和不包含它们,但问题是相同的。

azure base64 certificate mount azure-keyvault
1个回答
0
投票

确保您从 Base64 字符串中删除了以下两行:

-----BEGIN CERTIFICATE----- // remove this

(...)

-----END CERTIFICATE----- // and remove this

如果错误仍然存在,我建议使用可用的在线 Base64 验证器之一。

我喜欢base65.guru:https://base64.guru/tools/validator

© www.soinside.com 2019 - 2024. All rights reserved.