terraform-google-kubernetes-engine icon indicating copy to clipboard operation
terraform-google-kubernetes-engine copied to clipboard

reason:NetworkPluginNotReady message:Network plugin returns error: cni plugin not initialized

Open sadathknorket opened this issue 10 months ago • 0 comments

Hi , I encounter weird behaviour with this configuration .

Initially when I run this terraform it works provisioning the nodepools and nodes I need , But when I deleted the node pool manually and re-run this terraform to create a new node pool the nodes are not able to join the cluster and I get error saying reason:NetworkPluginNotReady message:Network plugin returns error: cni plugin not initialized

module "vpc" {
  source  = "terraform-google-modules/network/google"
  version = "~> 10.0"

  project_id   = ""
  network_name = "example-vpc4"
  routing_mode = "GLOBAL"

  subnets = [
    {
      subnet_name           = "subnet-01"
      subnet_ip             = "10.10.0.0/16" 
      subnet_region         = "us-west1"
    }
  ]

  secondary_ranges = {
    subnet-01 = [
      {
        range_name    = "subnet-01-secondary-01"
        ip_cidr_range = "192.168.0.0/16" # Large range for pods
      },
      {
        range_name    = "subnet-01-secondary-02"
        ip_cidr_range = "192.169.0.0/16" # Large range for services
      }
    ]
  }

  routes = [
    {
      name                   = "egress-internet1"
      description            = "route through IGW to access internet"
      destination_range      = "0.0.0.0/0"
      tags                   = "egress-inet"
      next_hop_internet      = true
    }
  ]
}

module "gke" {
  source                     = "terraform-google-modules/kubernetes-engine/google//modules/private-cluster"
  version                    = "~> 35.0"
  project_id                 = ""
  name                       = "gke-test-4"
  region                     = "us-west1"
  zones                      = ["us-west1-a"]
  network                    = module.vpc.network_name
  subnetwork                 = "subnet-01"
  ip_range_pods              = "subnet-01-secondary-01"
  ip_range_services          = "subnet-01-secondary-02"
  http_load_balancing        = false
  network_policy             = false
  horizontal_pod_autoscaling = true
  filestore_csi_driver       = false
  dns_cache                  = false
  deletion_protection        = false

  node_pools = [
    {
      name                        = "default-node-pool"
      machine_type                = "e2-medium"
      autoscaling                 = true
      node_locations              = "us-west1-a"
      min_count                   = 1
      max_count                   = 10
      local_ssd_count             = 0
      spot                        = false
      disk_size_gb                = 100
      disk_type                   = "pd-standard"
      image_type                  = "COS_CONTAINERD"
      auto_repair                 = true
      auto_upgrade                = true
      service_account             = "svc_account" (with owner role)
    }
  ]

  depends_on = [module.vpc]
}

sadathknorket avatar Jan 16 '25 05:01 sadathknorket