节点可用 3 不足 cpu

nodes are available 3 Insufficient cpu

我正在尝试 运行 以下示例:https://kubernetes.io/docs/tutorials/stateful-application/cassandra/ 当我 运行 在 minikube 上时,它 运行 很好。但是当我在 GKE 上 运行 时,我看到一个错误,0/3 nodes are available: 3 Insufficient cpu.

有人可以帮助我吗?

哪里可以增加CPU?在 stateful_set 或集群配置上?

我使用 terraform 创建了我的集群,配置如下:

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",
    ]
  }
}

谢谢

这里发生的事情是,默认情况下,您的集群是使用只有 1 个 vCPU 的 n1-standard-1 机器创建的。

您应该将有关您要使用的机器类型的信息添加到您的配置中,即:

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",
    ]
  }
}

并使用 n1-standard-2 或 n1-standard-4 在 variable.tf 文件中声明它,即:

variable "machine_type" {
    type = "string"
    default = "n1-standard-4"
}