Giter Club home page Giter Club logo

Comments (33)

morgante avatar morgante commented on August 16, 2024 4

@chrislovecnm My thoughts exactly. :) I opened #195 to track.

from terraform-google-kubernetes-engine.

brendanator avatar brendanator commented on August 16, 2024 1

I was able to get around this by using the default network for everything.

module "gke" {
  source                     = "terraform-google-modules/kubernetes-engine/google"
  project_id                 = "${var.project}"
  name                       = "${var.cluster_name}"
  region                     = "${var.region}"
  zones                      = "${var.zones}"
  network                    = "default"
  subnetwork                 = "default"
  ip_range_pods              = "default"
  ip_range_services          = "default"
}

I guess this means that I would have to manually create these networks/subnets to use different names?

Either these networks should be automatically generated or the documentation needs updating

from terraform-google-kubernetes-engine.

MichelBoucey avatar MichelBoucey commented on August 16, 2024 1

I knew this module wasn't used so far but it seems the only trick to trigger the discover or creation of the resource data.google_compute_subnetwork.gke_subnetwork...

Well, I'm just following the simple_regional_private example:

provider "google-beta" {
  version = "~> 2.7.0"
  project = "${var.project_id}"
  region  = "${var.region}"
}

data "google_compute_subnetwork" "subnetwork" {
  name    = "${var.subnetwork}"
  project = "${var.project_id}"
  region  = "${var.region}"
}

module "gke" {
  source                  = "terraform-google-modules/kubernetes-engine/google//modules/private-cluster"
  project_id              = "${var.project_id}"
  name                    = "${var.project_id}"
  regional                = true
  region                  = "${var.region}"
  network                 = "${var.network}"
  subnetwork              = "${var.subnetwork}"
  ip_range_pods           = "${var.network}-pods"
  ip_range_services       = "${var.network}-services"
  service_account         = "terraform@${var.project_id}.iam.gserviceaccount.com"
  enable_private_endpoint = true
  enable_private_nodes    = true
  master_ipv4_cidr_block  = "172.16.0.0/28"

  master_authorized_networks_config = [{
    cidr_blocks = [{
      cidr_block = "10.0.0.0/28"
      display_name = "VPC"
    }]
  }]
}

data "google_client_config" "default" {}

from terraform-google-kubernetes-engine.

DXCanas avatar DXCanas commented on August 16, 2024 1

Tried the suggestion here: #100 (comment)

  network                    = "default"

I was able to get around this by using the default network for everything.

module "gke" {
  source                     = "terraform-google-modules/kubernetes-engine/google"
  project_id                 = "${var.project}"
  name                       = "${var.cluster_name}"
  region                     = "${var.region}"
  zones                      = "${var.zones}"
  network                    = "default"
  subnetwork                 = "default"
  ip_range_pods              = "default"
  ip_range_services          = "default"
}

I guess this means that I would have to manually create these networks/subnets to use different names?

Either these networks should be automatically generated or the documentation needs updating

I don't really have the need for a shared network, but setting default in this way isn't working for me. Must I create a network despite the fact that the gcloud CLI will auto-assign to default?

from terraform-google-kubernetes-engine.

DXCanas avatar DXCanas commented on August 16, 2024 1

@morgante That's exactly right!

I get:

Error: Error applying plan:

1 error occurred:
	* module.kubernetes.module.gke.google_container_cluster.primary: 1 error occurred:
	* google_container_cluster.primary: Error waiting for creating GKE cluster: Retry budget exhausted (5 attempts): Secondary range "default" does not exist in network "default", subnetwork "default".

With this config:

module "gke" {
  source = "terraform-google-modules/kubernetes-engine/google"
  project_id = XXXXX
  name = "XXXX"
  region = "${var.cluster_region}"
  zones = ["${var.cluster_region}-a"]
  network = "default"
  subnetwork = "default"
  ip_range_pods = "default"
  ip_range_services = "default"

  http_load_balancing = true
  horizontal_pod_autoscaling = true
  network_policy = false
}

from terraform-google-kubernetes-engine.

rileykarson avatar rileykarson commented on August 16, 2024

Oh! This is an issue present in 2.1.0. If you restrict your provider to 2.0.0, or wait for 2.2.0 (hopefully later today / early tomorrow) this will work again.

from terraform-google-kubernetes-engine.

vdt-mik avatar vdt-mik commented on August 16, 2024

Hi! I have same issue too, but i have the new provider version:

* provider.google: version = "~> 2.2"
* provider.kubernetes: version = "~> 1.5"
* provider.null: version = "~> 2.1"
* provider.random: version = "~> 2.0"

from terraform-google-kubernetes-engine.

morgante avatar morgante commented on August 16, 2024

@rileykarson Can you confirm if this has been fixed in the provider?

from terraform-google-kubernetes-engine.

rileykarson avatar rileykarson commented on August 16, 2024

It should have been fixed in 2.2.0, if you can repro in an isolated config please file an issue.

from terraform-google-kubernetes-engine.

morgante avatar morgante commented on August 16, 2024

@vdt-mik Any chance you could share your config?

from terraform-google-kubernetes-engine.

aaron-lane avatar aaron-lane commented on August 16, 2024

@jonnymcgow7 can you please confirm if using version 2.2.0 or greater of the provider fixes this issue?

from terraform-google-kubernetes-engine.

s-u-b-h-a-k-a-r avatar s-u-b-h-a-k-a-r commented on August 16, 2024

@jonnymcgow7 can you please confirm if using version 2.2.0 or greater of the provider fixes this issue?
I am using the below versions but still facing the same issue.

https://github.com/SubhakarKotta/gcloud-gke-rds-terraform/tree/master/frameworks

provider "google" {
  version     = "~> 2.3.0"
  credentials = "${ file(var.credentials) }"
  project     = "${var.project_id}"
  region      = "${var.region}"
}

provider "google-beta" {
  version     = "~> 2.3.0"
  credentials = "${ file(var.credentials) }"
  project     = "${var.project_id}"
  region      = "${var.region}"
}

from terraform-google-kubernetes-engine.

aaron-lane avatar aaron-lane commented on August 16, 2024

@subhakarkotta can you please file as issue against https://github.com/terraform-providers/terraform-provider-google?

from terraform-google-kubernetes-engine.

s-u-b-h-a-k-a-r avatar s-u-b-h-a-k-a-r commented on August 16, 2024

@subhakarkotta can you please file as issue against https://github.com/terraform-providers/terraform-provider-google?

Issue filed hashicorp/terraform-provider-google#3746

from terraform-google-kubernetes-engine.

chrislovecnm avatar chrislovecnm commented on August 16, 2024

I am hitting this as well, and I am referencing the networking name in the gke module.

My providers

provider "google" {
  version = "2.7.0"
  project = "${var.project_id}"
  region  = "${var.region}"
}

provider "google-beta" {
  version = "2.7.0"
  project = "${var.project_id}"
  region  = "${var.region}"
}

snippet from my cluster

module "gke" {

  source = "terraform-google-modules/kubernetes-engine/google//modules/private-cluster"
  enable_private_endpoint    = "true"
  enable_private_nodes       = "true"
  // TODO make this configurable
  master_ipv4_cidr_block     = "10.0.0.0/28"

  project_id = "${var.project_id}"
  name       = "${var.cluster_name}"
  region   = "${var.region}"
  zones   = "${var.zones}" // FIXME we may need to convert a list to a string here
  regional   = true
  kubernetes_version    = "1.13.5-gke.10"

  network           = "${module.gke-network.network_name}"
  subnetwork        = "my-subnet" // TODO use a variable??
}

from terraform-google-kubernetes-engine.

chrislovecnm avatar chrislovecnm commented on August 16, 2024

I even added

output "name" {
  description = "Cluster name"
  value       = "${module.gke.name}"
  depends_on = [ "${module.gke-network.network_name}" ]
}

And that did not help

from terraform-google-kubernetes-engine.

aaron-lane avatar aaron-lane commented on August 16, 2024

@chrislovecnm could you try using an element of module.gke-network.subnets_names for the subnetwork argument of module.gke?

from terraform-google-kubernetes-engine.

chrislovecnm avatar chrislovecnm commented on August 16, 2024

It is an array, not a singular name, let me workout the syntax πŸ˜…

from terraform-google-kubernetes-engine.

aaron-lane avatar aaron-lane commented on August 16, 2024

"${element(module.gke-network.subnets_names, 0)}" should work, assuming the first subnet is the one you want to use.

from terraform-google-kubernetes-engine.

chrislovecnm avatar chrislovecnm commented on August 16, 2024

Wahoo! Yes adding the subnet as a var helped.

from terraform-google-kubernetes-engine.

aaron-lane avatar aaron-lane commented on August 16, 2024

@chrislovecnm Excellent!
@subhakarkotta does this solution work for you?

from terraform-google-kubernetes-engine.

s-u-b-h-a-k-a-r avatar s-u-b-h-a-k-a-r commented on August 16, 2024

@aaron-lane Thanks It worked

from terraform-google-kubernetes-engine.

MichelBoucey avatar MichelBoucey commented on August 16, 2024

Hi Aaron,

Terraform v0.11.14

  • provider.google v2.7.0
  • provider.google-beta v2.7.0
  • provider.kubernetes v1.7.0

I'm stuck on the same error when applying plan.

I tried "${element(module.gke-network.subnets_names, 0)}", but no module by that name.

from terraform-google-kubernetes-engine.

morgante avatar morgante commented on August 16, 2024

@MichelBoucey How are you creating your network? For that to work, you need gke-network module defined in the same Terraform config.

If you can share your Terraform config, we'll be able to help easier.

from terraform-google-kubernetes-engine.

morgante avatar morgante commented on August 16, 2024

@MichelBoucey What exactly is the error you get? It expects subnetwork name as an input.

from terraform-google-kubernetes-engine.

MichelBoucey avatar MichelBoucey commented on August 16, 2024

I get, exactly as @jonnymcgow7, module.gke.google_container_cluster.primary: Resource 'data.google_compute_subnetwork.gke_subnetwork' not found for variable 'data.google_compute_subnetwork.gke_subnetwork.self_link'

from terraform-google-kubernetes-engine.

morgante avatar morgante commented on August 16, 2024

@MichelBoucey Where is var.subnetwork coming from? Where are you defining your subnet creation?

from terraform-google-kubernetes-engine.

MichelBoucey avatar MichelBoucey commented on August 16, 2024

@morgante I thought it was just a name to provide, not to point at an already created resource by its name, but to create the subnetwork by that name. So, var.subnetwork is just a name coming from my terraform.tfvars.

from terraform-google-kubernetes-engine.

morgante avatar morgante commented on August 16, 2024

Ah, this module doesn't take care of creating the subnetwork. You need to provide a subnetwork from outside the module, which you can use the network module to handle.

from terraform-google-kubernetes-engine.

MichelBoucey avatar MichelBoucey commented on August 16, 2024

@morgante Oh thank you very much. It's clearer now. I thought terraform-google-kubernetes-engine module was self-sufficient to setup a full GKE service as there is for EKS. BTW: I'm a great beginner on GCP services...

from terraform-google-kubernetes-engine.

chrislovecnm avatar chrislovecnm commented on August 16, 2024

@morgante we should have an example that builds a network and a cluster as well. I have some TF that I can contribute, once I get the beta module stuff sorted

from terraform-google-kubernetes-engine.

morgante avatar morgante commented on August 16, 2024

@DXCanas I'm a little unclear on your ask. Most users of this module are using it with a custom network rather than the default VPC network.

If you want to use the default VPC, you should be able to thoughβ€”you just have to specify it. Is that not working for you?

from terraform-google-kubernetes-engine.

morgante avatar morgante commented on August 16, 2024

Got it, opened #211 to track.

from terraform-google-kubernetes-engine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.