【发布时间】:2022-01-23 07:23:31
【问题描述】:
我正在 GKE 上运行一个 Kubernetes 集群。我想为每个节点池启用auto_upgrade,我想在 terraform 中执行此操作。我不确定如何。
节点池是用这样的 terraform 定义的
module "main-gke-cluster" {
source = "../modules/gke-cluster"
cluster_name = local.stage_main_cluster_name
// SNIP...
node_pools = {
default-pool = {
machine_type = "e2-standard-2"
image_type = "UBUNTU"
initial_node_count = 1
min_nodes = 0
max_nodes = 10
preemptible = true
node_locations = [
"europe-west4-a"
]
labels = {}
taints = []
oauth_scopes = local.default_pool_scopes
has_gpu = false
}
我试图像这样在节点池上设置auto_upgrade
module "main-gke-cluster" {
source = "../modules/gke-cluster"
cluster_name = local.stage_main_cluster_name
// SNIP...
node_pools = {
default-pool = {
machine_type = "e2-standard-2"
image_type = "UBUNTU"
initial_node_count = 1
min_nodes = 0
max_nodes = 10
auto_upgrade = true
preemptible = true
node_locations = [
"europe-west4-a"
]
labels = {}
taints = []
oauth_scopes = local.default_pool_scopes
has_gpu = false
}
即我添加了一个auto_upgrade 参数。
这似乎对terraform plan 没有影响。
知道我在这里缺少什么吗?
【问题讨论】:
-
模块
main-gke-cluster的内容是什么?它是否需要auto_upgrade参数? -
您在使用 Jetstack gke-cluster 模块吗?看起来你是。我相信这已被弃用,取而代之的是github.com/terraform-google-modules/…
-
我在 terraform 配置中的任何地方都没有看到 Jetstack 一词。我可能正在使用它,但不确定。我怎么知道?
-
可能还有另一组 Terraform 文件组织为 module,位于相对路径
../modules/gke-cluster。如果此位置的 Terraform 模块不期望它,仅添加auto_upgrade不会做任何事情,您需要先修改该模块。这个模块的内容是什么? -
@MontgomeryWatts 你说的太对了。我在
../modules/gke-cluster位置管理中找到了这个{ auto_repair = false auto_upgrade = false } 我想我现在知道如何解决这个问题了。谢谢!
标签: kubernetes terraform google-kubernetes-engine