【问题标题】:Setting GKE node pool to auto_upgrade将 GKE 节点池设置为 auto_upgrade
【发布时间】: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


【解决方案1】:

假设您使用的是Jetstack gke-module,那么默认情况下节点池将设置为使用自动升级。但是如果你想显式启用自动升级,那么我相信你要使用的参数是“management_auto_upgrade”。

【讨论】:

  • 嗯。我尝试添加该参数,但它似乎无法识别。 ``` default-pool = { machine_type = "e2-standard-2" image_type = "UBUNTU" initial_node_count = 1 min_nodes = 0 max_nodes = 10 management_auto_upgrade = true ``` 我看到 terraform 计划没有任何变化。我很确定我的节点池当前没有设置为自动升级,因为 GKE 控制台显示该设置已禁用。
猜你喜欢
  • 2022-01-15
  • 2021-06-20
  • 2020-03-31
  • 2023-03-11
  • 1970-01-01
  • 2022-08-20
  • 2020-06-10
  • 1970-01-01
  • 2017-10-11
相关资源
最近更新 更多