我正在尝试运行以下示例: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)
这里发生的是,默认情况下,群集是使用仅具有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在变量.tf文件中声明它,即:
variable "machine_type" {
type = "string"
default = "n1-standard-4"
}