kubernetes - Terraform:具有不同区域节点的 GKE 集群
问题描述
我有这个带有 3 个节点的 Terraform GKE 集群。当我部署此集群时,所有节点都位于相同的区域中,即europe-west1-b
.
gke-cluster.yml
resource "google_container_cluster" "primary" {
name = var.cluster_name
initial_node_count = var.initial_node_count
master_auth {
username = ""
password = ""
client_certificate_config {
issue_client_certificate = false
}
}
node_config {
//machine_type = "e2-medium"
oauth_scopes = [
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
]
metadata = {
disable-legacy-endpoints = "true"
}
labels = {
app = var.app_name
}
tags = ["app", var.app_name]
}
timeouts {
create = "30m"
update = "40m"
}
}
variables.tf
variable "cluster_name" {
default = "cluster"
}
variable "app_name" {
default = "my-app"
}
variable "initial_node_count" {
default = 3
}
variable "kubernetes_min_ver" {
default = "latest"
}
variable "kubernetes_max_ver" {
default = "latest"
}
variable "remove_default_node_pool" {
default = false
}
variable "project" {
default = "your-project-name"
}
variable "credentials" {
default = "terraform-key.json"
}
variable "region" {
default = "europe-west1"
}
variable "zone" {
type = list(string)
description = "The zones to host the cluster in."
default = ["europe-west1-b", "europe-west1-c", "europe-west1-d"]
}
并且想知道是否可以将每个节点部署在不同的区域中。如果是,我该如何使用 Terraform?
解决方案
推荐阅读
- java - 如何知道文件在 Hadoop MapRedcue 的 Mapper 函数中被完全读取?
- python - slack-api 中是否可以有多个包含不同数据的外部选择菜单?
- python-3.x - 从 TF 数据集获取样本
- javascript - 即使所有轨道关闭,停止共享按钮也不会消失?
- python - 从数据框中的句子中的两个列表中提取单词
- django - 将图像渲染到 Django 管理中的选择/字符字段
- javascript - Electron“处理程序中发生错误” ipcRenderer.invoke
- python - 私有数据集的正确 GCS 路径是什么?
- android - 我们如何在 Scala 中使用 android JobIntentService?
- c# - Asp .net core SignalR 发送实时数据