1

I have setup my Azure Kubernetes Cluster using Terraform and it working good.

I trying to deploy packages using Helm but not able to deploy getting below error.

Error: chart "stable/nginx-ingress" not found in https://kubernetes-charts.storage.googleapis.com repository

Note: I tried other packages as well my not able to deploy using "Terraform Resource" below is Terraform code. I tried local helm package using helm command and it works. I think the issue with Terraform helm resources. "nginx" is a sample package not able to deploy any package using Terraform.

resource "azurerm_kubernetes_cluster" "k8s" {
  name                = var.aks_cluster_name
  location            = var.location
  resource_group_name = var.resource_group_name
  dns_prefix          = var.aks_dns_prefix
  kubernetes_version  = "1.19.0"
  # private_cluster_enabled = true
  linux_profile {
    admin_username = var.aks_admin_username
    ssh_key {
      key_data = var.aks_ssh_public_key
    }
  }
  default_node_pool {
    name                = var.aks_node_pool_name
    enable_auto_scaling = true
    node_count          = var.aks_agent_count
    min_count           = var.aks_min_agent_count
    max_count           = var.aks_max_agent_count
    vm_size             = var.aks_node_pool_vm_size
  }
  service_principal {
    client_id     = var.client_id
    client_secret = var.client_secret
  }

#   tags = data.azurerm_resource_group.rg.tags
}

provider "helm" {
  version = "1.3.2"
  kubernetes {
    host = azurerm_kubernetes_cluster.k8s.kube_config[0].host
    client_key             = base64decode(azurerm_kubernetes_cluster.k8s.kube_config[0].client_key)
    client_certificate     = base64decode(azurerm_kubernetes_cluster.k8s.kube_config[0].client_certificate)
    cluster_ca_certificate = base64decode(azurerm_kubernetes_cluster.k8s.kube_config[0].cluster_ca_certificate)
    load_config_file       = false
  }
}

resource "helm_release" "nginx-ingress" {
  name        = "nginx-ingress-internal"
  repository  = "https://kubernetes-charts.storage.googleapis.com"
  chart       = "stable/nginx-ingress"
  set {
        name  = "rbac.create"
        value = "true"
    }
}

1 Answer 1

1

You should skip stable in the chart name: it is a repository name but you have no helm repositories defined. Your resource should look like:

resource "helm_release" "nginx-ingress" {
  name        = "nginx-ingress-internal"
  repository  = "https://kubernetes-charts.storage.googleapis.com"
  chart       = "nginx-ingress"
  ...
}

which is an equivalent to the helm command:

helm install nginx-ingress-internal nginx-ingress --repo https://kubernetes-charts.storage.googleapis.com 

Alternatively you can define repositories with the repository_config_path.

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you. I have existing code with lots of custom charts and all repository pointing to "repository = "helm.cyberproof.io:8080"" and am getting error. Any idea?
The urls should contain the protocol, i.e. http://helm.cyberproof.io:8080
I have code like this resource "helm_release" "clc" { name = "clc-release" repository = "helm.cyberproof.io:8080" chart = "clc" version = "1.1.71-axa" dependency_update = true wait = false timeout = 1800 }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.