带有 agic 的 Azure AKS - 如何使用 Terraform 创建它?

Azure AKS with agic - how to create it with Terraform?

我目前正在为 AKS 环境 (https://azure.github.io/application-gateway-kubernetes-ingress/setup/install-existing/#using-a-service-principal) 设置 AGIC(Kubernetes 应用程序网关入口控制器)。

由于整个环境是使用 Terraform 设置的,我想也使用 Terraform 安装必要的 Helm 存储库。

以为,下面的简单代码应该可以解决问题:


data "helm_repository" "agic_repo" {
 name      = "agic_repository"
 url       = "https://appgwingress.blob.core.windows.net/ingress-azure-helm-package/"
}

resource "helm_release" "agic" {
 name        = "agic"
 namespace   = "agic"
 repository  = data.helm_repository.agic_repo.metadata[0].url
 chart       = "application-gateway-kubernetes-ingress"

 depends_on = [
    data.helm_repository.agic_repo,
  ]
}

但我 运行 进入这个问题:


module.agic.helm_release.agic: Creating...



Error: chart "application-gateway-kubernetes-ingress" not found in https://appgwingress.blob.core.windows.net/ingress-azure-helm-package/ repository



  on ../../modules/agic/main.tf line 91, in resource "helm_release" "agic":

  91: resource "helm_release" "agic" {

这么看来,好像找不到包裹了。之前有其他人解决过这个问题吗?

我不熟悉 Helm,所以我不知道如何 'browse' 在 Helm 存储库中检查我是否在寻址正确的 URI...

所以我用

手动添加了回购协议
helm repo add application-gateway-kubernetes-ingress https://appgwingress.blob.core.windows.net/ingress-azure-helm-package/

当我搜索我收到的回购协议时:

V5T:~$ helm search | grep ingress
application-gateway-kubernetes-ingress/ingress-azure    1.0.0           1.0.0                   Use Azure Application Gateway as the ingress for an Azure...

感谢任何帮助!

P.S.: 当然,我可以用 bash 一行代码来完成,但是如果整个环境由 Terraform 创建就更好了...

根据您提供的数据,应该是这样的:

resource "helm_release" "agic" {
 name        = "agic"
 namespace   = "agic"
 repository  = data.helm_repository.agic_repo.metadata[0].url
 chart       = "ingress-azure"

 depends_on = [
    data.helm_repository.agic_repo,
  ]
}

所以图表名称不同