2

I have been trying to install Helm charts using Terraform in a cluster which operates in GKE.

My question is in two parts:

  1. Is it a good practice to use Terraform for installing Helm charts?
  2. I have been getting this error when Terraform tries to install a Helm chart:

helm_release.release_name: Get https://XX.XXX.XX.X/apis/extensions/v1beta1/namespaces/kube-system/deployments/tiller-deploy: dial tcp XX.XXX.XX.X:443: connect: connection refused

Here is how I am configuring the Helm chart:

provider "kubernetes" { host = "${var.cluster-host}" username = "${var.cluster-username}" password = "${var.cluster-password}" client_certificate = "${base64decode(var.cluster-client-cert)}" client_key = "${base64decode(var.cluster-client-key)}" cluster_ca_certificate = "${base64decode(var.cluster-ca-certificate)}" } resource "kubernetes_service_account" "tiller" { metadata { name = "tiller" namespace = "kube-system" } } resource "kubernetes_cluster_role_binding" "tiller" { metadata { name = "tiller" } role_ref { api_group = "rbac.authorization.k8s.io" kind = "ClusterRole" name = "cluster-admin" } # api_group has to be empty because of a bug: # https://github.com/terraform-providers/terraform-provider-kubernetes/issues/204 subject { api_group = "" kind = "ServiceAccount" name = "tiller" namespace = "kube-system" } } provider "helm" { install_tiller = true service_account = "tiller" namespace = "kube-system" kubernetes { host = "${var.cluster-host}" username = "${var.cluster-username}" password = "${var.cluster-password}" client_certificate = "${base64decode(var.cluster-client-cert)}" client_key = "${base64decode(var.cluster-client-key)}" cluster_ca_certificate = "${base64decode(var.cluster-ca-certificate)}" } } 
2
  • I suggest you check from where you are executing terraform trying to connect your k8s cluster with a kubeconfig you have defined in terraform. Once you are sure you can connect to your k8s cluster, try to install/init helm manually. Doing these steps manually gives you any error? Commented Mar 13, 2019 at 14:54
  • I suspect the helm provider is running before the Tiller is ready. Commented May 6, 2019 at 19:31

1 Answer 1

1
  1. you can use terraform to install helm charts, you dont have to obviously
  2. something is probably wrong with your kubernetes connection, check if its actually working

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.