0

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

任何人都可以帮助我吗?

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

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

谢谢

0/3 个节点可用:3 cpu 不足。

4

1 回答 1

3

这里发生的情况是,默认情况下,您的集群是使用只有 1vCPU 的 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"
}
于 2019-01-29T21:42:59.413 回答