nodes are available 3 Insufficient cpu

1/29/2019

I’m trying to run the following example: https://kubernetes.io/docs/tutorials/stateful-application/cassandra/ When I run on minikube, it runs well. But when I run on GKE, I see an error, 0/3 nodes are available: 3 Insufficient cpu.

Anyone can help me please?

Where I can increase CPU? On stateful_set or on kluster config?

I created my cluster with terraform, with the following configurations:

resource "google_container_cluster" "gcloud_cluster" {
  name               = "gcloud-cluster-${var.workspace}"
  zone               = "us-east1-b"
  initial_node_count = 3
  project            = "${var.project}"

  addons_config {
    network_policy_config {
      disabled = true
    }
  }

  master_auth {
    username = "${var.username}"
    password = "${var.password}"
  }

  node_config {
    oauth_scopes = [
      "https://www.googleapis.com/auth/devstorage.read_only",
      "https://www.googleapis.com/auth/logging.write",
      "https://www.googleapis.com/auth/monitoring",
      "https://www.googleapis.com/auth/service.management.readonly",
      "https://www.googleapis.com/auth/servicecontrol",
      "https://www.googleapis.com/auth/trace.append",
      "https://www.googleapis.com/auth/compute",
    ]
  }
}

Thanks

0/3 nodes are available: 3 Insufficient cpu.

-- Rui Martins
cassandra
elassandra
google-kubernetes-engine
kubernetes
terraform

1 Answer

1/29/2019

What is happening here is that by default your cluster is being created using n1-standard-1 machines which have only 1vCPU.

You should add to your config information about machine type you want to use i.e:

resource "google_container_cluster" "gcloud_cluster" {
  name               = "gcloud-cluster-${var.workspace}"
  zone               = "us-east1-b"
  initial_node_count = 3
  project            = "${var.project}"

  addons_config {
    network_policy_config {
      disabled = true
    }
  }

  master_auth {
    username = "${var.username}"
    password = "${var.password}"
  }

  node_config {
    machine_type = "${var.machine_type}"
    oauth_scopes = [
      "https://www.googleapis.com/auth/devstorage.read_only",
      "https://www.googleapis.com/auth/logging.write",
      "https://www.googleapis.com/auth/monitoring",
      "https://www.googleapis.com/auth/service.management.readonly",
      "https://www.googleapis.com/auth/servicecontrol",
      "https://www.googleapis.com/auth/trace.append",
      "https://www.googleapis.com/auth/compute",
    ]
  }
}

and declare it in variable.tf file using either n1-standard-2 or n1-standard-4 i.e:

variable "machine_type" {
    type = "string"
    default = "n1-standard-4"
}
-- dongi
Source: StackOverflow