【问题标题】:Helm with Azure results in 401 Unauthorized使用 Azure 的 Helm 导致 401 Unauthorized
【发布时间】:2021-08-19 06:55:09
【问题描述】:

Helm 版本:3.6.1

以下步骤使用 ACR 成功,添加远程图表 repo:

  1. helm repo add myrepo https://myrepo.azurecr.io/helm/v1/repo --username "..." --password "..."
  2. helm search repo myrepo --> 列出可用的图表存储库

但一旦我尝试安装具有相同凭据的图表:(helm pull 相同)
helm install myhelmtest mytest/testchart --username "..." --password "..." --debug
这将导致:
[debug] failed to fetch https://myrepo.azurecr.io/helm/v1/repo/_blobs/testchart-0.1.0.tgz : 401 Unauthorized

我也事先尝试了一个成功的helm registry login 并使用相同的凭据,但它对上述命令没有影响。

有什么建议/想法吗?

【问题讨论】:

    标签: azure kubernetes-helm azure-repos helm3


    【解决方案1】:

    您可以传递适合您的方案的注册表凭据,例如服务主体凭据或存储库范围的令牌。

    例如,您可以创建一个 Azure Active Directory 服务主体,对注册表具有拉取和推送权限(AcrPush 角色)。然后将服务主体凭据提供给 helm 注册表登录。以下示例使用环境变量提供密码:

    echo $spPassword | helm registry login mycontainerregistry.azurecr.io \
      --username <service-principal-id> \
      --password-stdin
    

    您还可以使用个人 Azure AD 身份登录注册表以推送和拉取 Helm 图表。

    az acr login --name <acrName>
    

    https://docs.microsoft.com/en-us/azure/container-registry/container-registry-authentication?tabs=azure-cli#individual-login-with-azure-ad

    使用以下 Azure 文档对 Azure ACR Helm 存储库进行身份验证。 https://docs.microsoft.com/en-us/azure/container-registry/container-registry-helm-repos#authenticate-with-the-registry

    【讨论】:

    • 我使用的凭据是容器注册表的管理员凭据(用户名、密钥) - 有趣的事实:它们确实适用于 helm install 的同事,但不适用于我......跨度>
    • 您是否首次使用 az acr login --name
    猜你喜欢
    • 2022-10-20
    • 1970-01-01
    • 2013-01-20
    • 2018-07-27
    • 1970-01-01
    • 2016-04-05
    • 1970-01-01
    • 1970-01-01
    • 2020-01-01
    相关资源
    最近更新 更多