Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

while creating cluster via terraform, the Google API is throwing 502 error. #1635

Closed
miteshr93 opened this issue May 12, 2023 · 1 comment
Closed
Labels
bug Something isn't working Stale

Comments

@miteshr93
Copy link

miteshr93 commented May 12, 2023

Hi,

We are creating GKE cluster with terraform using GCP cloud build.

While creating cluster via terraform using cloud build we are getting below error timeout related error
intermittently.


---[ RESPONSE ]--------------------------------------
Step #1 - "Run terraform": HTTP/2.0 502 Bad Gateway
Step #1 - "Run terraform": Content-Length: 1613
Step #1 - "Run terraform": Content-Type: text/html; charset=UTF-8
Step #1 - "Run terraform": Date: Thu, 04 May 2023 07:29:58 GMT
Step #1 - "Run terraform": Referrer-Policy: no-referrer
Step #1 - "Run terraform":
Step #1 - "Run terraform":
Step #1 - "Run terraform":
Step #1 - "Run terraform":
Step #1 - "Run terraform":
Step #1 - "Run terraform": <title>Error 502 (Server Error)!!1</title>
Step #1 - "Run terraform": <style>
Step #1 - "Run terraform": {margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px} > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
Step #1 - "Run terraform": </style>
Step #1 - "Run terraform": ](http://www.google.com/%3E)
Step #1 - "Run terraform":

502. That’s an error.
Step #1 - "Run terraform":

The server encountered a temporary error and could not complete your request.

Please try again in 30 seconds. That’s all we know.

---[ RESPONSE ]--------------------------------------
Step #1 - "Run terraform": HTTP/2.0 502 Bad Gateway
Step #1 - "Run terraform": Content-Length: 1613
Step #1 - "Run terraform": Content-Type: text/html; charset=UTF-8
Step #1 - "Run terraform": Date: Thu, 04 May 2023 07:29:58 GMT
Step #1 - "Run terraform": Referrer-Policy: no-referrer
Step #1 - "Run terraform":
Step #1 - "Run terraform":
Step #1 - "Run terraform":
Step #1 - "Run terraform":
Step #1 - "Run terraform":
Step #1 - "Run terraform": Error 502 (Server Error)!!1
Step #1 - "Run terraform":
Step #1 - "Run terraform":
Step #1 - "Run terraform":
502. That’s an error.
Step #1 - "Run terraform":
The server encountered a temporary error and could not complete your request.

Expected behavior

No response

Observed behavior

No response

Terraform Configuration

resource "google_container_cluster" "gkecluster" {
  provider                  = google-beta
  name                      = var.gke_cluster_name
  location                  = var.location
  remove_default_node_pool  = true
  initial_node_count        = 1
  network                   = var.vpc_name
  subnetwork                = var.subnet_name
  default_max_pods_per_node = var.max_pods_per_node
  min_master_version        = data.google_container_engine_versions.gke_version.latest_master_version
  resource_labels           = var.gke_resource_labels
  enable_shielded_nodes     = var.enable_shielded_nodes

  ip_allocation_policy {
    cluster_secondary_range_name  = var.use_existing_secondary_ranges ? var.pod_ip_range : null
    services_secondary_range_name = var.use_existing_secondary_ranges ? var.service_ip_range : null
    cluster_ipv4_cidr_block       = !var.use_existing_secondary_ranges ? var.pod_ip_range : null
    services_ipv4_cidr_block      = !var.use_existing_secondary_ranges ? var.service_ip_range : null
  }

  dynamic "confidential_nodes" {
    for_each = var.enable_confidential_nodes ? toset([1]) : toset([])
    content {
      enabled = var.enable_confidential_nodes
    }
  }

  binary_authorization {
    evaluation_mode = var.enable_binary_authorization ? "PROJECT_SINGLETON_POLICY_ENFORCE" : "DISABLED"
  }

  dynamic "master_authorized_networks_config" {
    for_each = var.create_private_cluster ? toset([1]) : toset([])
    content {
      cidr_blocks {
        cidr_block   = var.subnet_cidr
        display_name = "primarysubnet"
      }
    }
  }

  dynamic "private_cluster_config" {
    for_each = var.create_private_cluster ? toset([1]) : toset([])
    content {
      master_ipv4_cidr_block  = var.master_ipv4_cidr_block
      enable_private_endpoint = true
      enable_private_nodes    = true
      master_global_access_config {
        enabled = false
      }
    }
  }

  workload_identity_config {
    workload_pool = "${var.project}.svc.id.goog"
  }

  monitoring_config {
    managed_prometheus {
      enabled = true
    }
    enable_components = var.gke_monitoring_components
  }

  logging_config {
    enable_components = var.gke_logging_components
  }

  release_channel {
    channel = "UNSPECIFIED"
  }

  lifecycle {
    precondition {
      condition     = var.use_existing_secondary_ranges ? length(regexall("[a-z]", var.pod_ip_range)) > 0 && length(regexall("[a-z]", var.service_ip_range)) > 0 : length(regexall("/", var.pod_ip_range)) > 0 && length(regexall("/", var.service_ip_range)) > 0
      error_message = "If using existing secondary ranges, make sure you pass pod & service secondary range names and if not, pass CIDR block or just netmask, like /20, to pod_ip_range and service_ip_range variables"
    }

    ignore_changes = [
      node_config,
      initial_node_count
    ]
  }

  addons_config {
    http_load_balancing {
      disabled = !var.gke_load_balancing
    }
    network_policy_config {
      disabled = !var.gke_network_policy
    }
    dns_cache_config {
      enabled = var.gke_dns_cache
    }
  }


  dynamic "network_policy" {
    for_each = var.gke_network_policy ? toset([1]) : toset([])
    content {
      enabled = var.gke_network_policy
      provider = var.network_policy_provider
    }
  }

  dynamic "database_encryption" {
    for_each = var.database_encryption

    content {
      key_name = database_encryption.value.key_name
      state    = database_encryption.value.state
    }
  }
}

Terraform Version

1.2.7

Additional information

No response

@miteshr93 miteshr93 added the bug Something isn't working label May 12, 2023
@github-actions
Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the Stale label Jul 17, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale
Projects
None yet
Development

No branches or pull requests

1 participant