节点可用cpu不足3

sycxhyv7  于 2021-06-14  发布在  Cassandra
关注(0)|答案(1)|浏览(566)

我尝试运行以下示例:https://kubernetes.io/docs/tutorials/stateful-application/cassandra/ 当我在minikube上跑步时,它跑得很好。但当我在gke上运行时,我看到一个错误, 0/3 nodes are available: 3 Insufficient cpu. 有人能帮我吗?
哪里可以增加cpu?在有状态集上还是在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",
    ]
  }
}

谢谢

jljoyd4f

jljoyd4f1#

这里发生的是,默认情况下,您的集群是使用只有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"
}

相关问题