从 Azure 容器注册表部署 Helm Chart

问题描述

我有一个包含以下内容的多级管道

阶段构建:

  1. 构建 docker 镜像
  2. 将图像推送到 ACR
  3. 包掌舵图
  4. 将舵图推送到 ACR

阶段部署:

  1. 头盔升级

将掌舵图推送到 AKS:

 task: HelmDeploy@0
 displayName: 'helm publish'
 inputs:
   azureSubscriptionForACR: '$(azureSubscription)'
   azureResourceGroupForACR: '$(resourceGroup)'
   azureContainerRegistry: '$(containerRegistry)'
   command: 'save'
   arguments: '--app-version $(Version)'
   chartNameForACR: 'charts/$(imageRepository):$(Version)'
   chartPathForACR: $(chartPath)

将舵图部署到 AKS:

  task: HelmDeploy@0
  inputs:
    connectionType: 'Kubernetes Service Connection'
    kubernetesServiceConnection: '$(kubernetesServiceConnection)'
    command: 'upgrade'
    chartType: 'Name'
    chartName: '$(containerRegistry)/charts/$(imageRepository):$(Version)'
    chartVersion: '$(Version)'
    azureSubscriptionForACR: '$(azureSubscription)'
    azureResourceGroupForACR: '$(resourceGroup)'
    azureContainerRegistry: '$(containerRegistry)'
    install: true
    releaseName: $(Version)

错误

Failed to download "<ACR>/charts/<repository>:0.9.26" at version "0.9.26" (hint: running `helm repo update` may help)

ACR: az acr repository show-manifests --name <org> --repository helm/charts/<repository> --detail

  {
    "changeableAttributes": {
      "deleteEnabled": true,"listEnabled": true,"readEnabled": true,"writeEnabled": true
    },"configMediaType": "application/vnd.cncf.helm.config.v1+json","createdTime": "2021-02-02T11:54:54.1623765Z","digest": "sha256:fe7924415c4e76df370630bbb0248c9296f27186742e9272eeb87b2322095c83","imageSize": 3296,"lastUpdateTime": "2021-02-02T11:54:54.1623765Z","mediaType": "application/vnd.oci.image.manifest.v1+json","tags": [
      "0.9.26"
    ]
  }

我做错了什么?我是否必须先从 ACR export helm chart 才能部署它?

解决方法

helm upgrade 的语法应该是这样的:

- task: HelmDeploy@0
  displayName: 'helm upgrade'
  inputs:
    connectionType: 'Kubernetes Service Connection'
    kubernetesServiceConnection: connection
    command: upgrade
    chartName: '$(name)'
    chartVersion: '$(Version)'
    releaseName: azuredevopsdemo

尝试将 chartName 值替换为 charts/$(imageRepository)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...