[英]Is it possible to create a zone only node pool in a regional cluster in GKE?
I have a regional cluster for redundancy.我有一个用于冗余的区域集群。 In this cluster I want to create a node-pool in just 1 zone in this region.
在这个集群中,我想在这个区域的 1 个区域中创建一个节点池。 Is this configuration possible?
这种配置可行吗? reason I trying this is, I want to run service like RabbitMQ in just 1 zone to avoid split, and my application services running on all zones in the region for redundancy.
我尝试这样做的原因是,我想在 1 个区域中运行 RabbitMQ 之类的服务以避免分裂,并且我的应用程序服务在该区域的所有区域上运行以实现冗余。
I am using terraform to create the cluster and node pools, below is my config for creating region cluster and zone node pool我正在使用 terraform 创建集群和节点池,下面是我用于创建区域集群和区域节点池的配置
resource "google_container_cluster" "regional_cluster" {
provider = google-beta
project = "my-project"
name = "my-cluster"
location = "us-central1"
node_locations = ["us-central1-a", "us-central1-b", "us-central1-c"]
master_auth {
username = ""
password = ""
client_certificate_config {
issue_client_certificate = false
}
}
}
resource "google_container_node_pool" "one_zone" {
project = google_container_cluster.regional_cluster.project
name = "zone-pool"
location = "us-central1-b"
cluster = google_container_cluster.regional_cluster.name
node_config {
machine_type = var.machine_type
image_type = var.image_type
disk_size_gb = 100
disk_type = "pd-standard"
}
}
This throws an error message这会引发错误消息
error creating NodePool: googleapi: Error 404: Not found: projects/my-project/zones/us-central1-b/clusters/my-cluster., notFound
Found out that location
in google_container_node_pool
should specify cluster master's region/zone.发现
google_container_node_pool
中的location
应指定集群主机的区域/区域。 To actually specify the node-pool location node_locations
should be used.要实际指定节点池位置,应使用
node_locations
。 Below is the config that worked以下是有效的配置
resource "google_container_cluster" "regional_cluster" {
provider = google-beta
project = "my-project"
name = "my-cluster"
location = "us-central1"
node_locations = ["us-central1-a", "us-central1-b", "us-central1-c"]
master_auth {
username = ""
password = ""
client_certificate_config {
issue_client_certificate = false
}
}
}
resource "google_container_node_pool" "one_zone" {
project = google_container_cluster.regional_cluster.project
name = "zone-pool"
location = google_container_cluster.regional_cluster.location
node_locations = ["us-central1-b"]
cluster = google_container_cluster.regional_cluster.name
node_config {
machine_type = var.machine_type
image_type = var.image_type
disk_size_gb = 100
disk_type = "pd-standard"
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.