简体   繁体   中英

Connect to GKE cluster dynamically using terraform

I am using Terraform script to spin up a GKE cluster and then use helm 3 to install splunk connector on the cluster.

How do I connect to the newly created cluster in terraform kube.netes provider dynamically?

Let the provider depend on the cluster certificate:

data "google_client_config" "terraform_config" {
  provider = google
}

provider "kubernetes" {
  load_config_file = false
  host = "https://${google_container_cluster.my_cluster.endpoint}"
  cluster_ca_certificate = base64decode(google_container_cluster.my_cluster.master_auth[0].cluster_ca_certificate)
  token = data.google_client_config.terraform_config.access_token
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM