Environment 环境Rancher v2.10.7, v2.11.3 and Terraform provisioned GKE ClusterRancher v2.10.7、 v2.11.3 和 Terraform 配置的 GKE 集群Situation 地理位置When using the Rancher2 Terraform provider to manage GKE clusters, adding a node pool to an existing cluster triggers the recreation of the entire cluster. This behavior is not observed when using the Rancher UI or the Google Cloud Terraform provider.使用 Rancher2 Terraform 提供者管理 GKE 集群时向现有集群添加节点池会触发整个集群的重建。使用 Rancher UI 或 Google Cloud Terraform 提供商时未观察到此行为。Terraform plan output below shows that adding the node_pools block forces the replacement of the rancher2_cluster.gke_cluster resource下面的 Terraform 规划输出显示添加 node_pools 块会强制替换 rancher2_cluster.gke_cluster 资源span stylecolor:#000000span stylebackground-color:#ffffffspan stylebackground-color:#efefefcode # rancher2_cluster.gke_cluster must be replaced -/ resource rancher2_cluster gke_cluster { ~ annotations { node_pools { initial_node_count 1 max_pods_constraint 110 name second-pool version 1.30.11-gke.1157000 autoscaling (known after apply) config (known after apply) # forces replacement management (known after apply) # rancher2_cluster_sync.sync must be replaced -/ resource rancher2_cluster_sync sync { ~ cluster_id c-jstj7 - (known after apply) # forces replacement/code/span/span/spanNote: Any configuration changes on existing nodepools or removing existing nodepools doesnt initiate cluster recreation注意对现有节点池进行任何配置更改或移除现有节点池都不会启动集群重建Resolution 结局The issue is resolved in the Rancher versions v2.10.7, v2.11.3 and v2.12.0, and Rancher2 Terraform provider versions v6.7.0, v7.3.0 and v8.0.0该问题在 Rancher 版本 v2.10.7、v2.11.3 和 v2.12.0 以及 Rancher2 Terraform 提供者版本 v6.7.0、v7.3.0 和 v8.0.0 中得到解决Upgrade to these versions to avoid full cluster recreation when adding node pools.升级到这些版本以避免在添加节点池时重组整个集群。After the fix is applied, as shown in the output, Terraform detects the addition of a new node pool and performs an in-place modification of the rancher2_cluster.gke_cluster.修复完成后如输出所示Terraform 检测到新增节点池并对 rancher2_cluster.gke_cluster 进行原地修改。span stylecolor:#000000span stylebackground-color:#ffffffspan stylebackground-color:#efefefcode # rancher2_cluster.gke_cluster will be updated in-place ~ resource rancher2_cluster gke_cluster { id c-c7mg5 name gke-sh ~ gke_config_v2 { name gke-sh node_pools { initial_node_count 1 max_pods_constraint 110 name second-pool version 1.30.12-gke.1208000 autoscaling (known after apply) config (known after apply) management (known after apply) } rancher2_cluster.gke_cluster: Modifying... [idc-c7mg5] rancher2_cluster.gke_cluster: Modifications complete after 1s [idc-c7mg5] Apply complete! Resources: 0 added, 1 changed, 0 destroyed./code/span/span/spanCause 病因The Rancher2 Terraform provider lacked the granular control necessary to manage individual node pools separately. So it treats the entire list as a single entity. Any change to the node_pools list was interpreted as a complete replacement of the existing configuration, leading to a full cluster replacement.Rancher2 Terraform 提供商缺乏管理单个节点池所需的细致控制。所以它把整个列表当作一个实体来处理。对 node_pools 列表的任何更改都被视为对现有配置的完全替换导致整个集群的替换。访问Rancher-K8S解决方案博主企业合作伙伴 https://blog.csdn.net/lidw2009
87. 使用 Rancher2 Terraform provider 向现有 GKE 集群添加节点池会导致完整集群重建
发布时间:2026/5/23 13:50:37
Environment 环境Rancher v2.10.7, v2.11.3 and Terraform provisioned GKE ClusterRancher v2.10.7、 v2.11.3 和 Terraform 配置的 GKE 集群Situation 地理位置When using the Rancher2 Terraform provider to manage GKE clusters, adding a node pool to an existing cluster triggers the recreation of the entire cluster. This behavior is not observed when using the Rancher UI or the Google Cloud Terraform provider.使用 Rancher2 Terraform 提供者管理 GKE 集群时向现有集群添加节点池会触发整个集群的重建。使用 Rancher UI 或 Google Cloud Terraform 提供商时未观察到此行为。Terraform plan output below shows that adding the node_pools block forces the replacement of the rancher2_cluster.gke_cluster resource下面的 Terraform 规划输出显示添加 node_pools 块会强制替换 rancher2_cluster.gke_cluster 资源span stylecolor:#000000span stylebackground-color:#ffffffspan stylebackground-color:#efefefcode # rancher2_cluster.gke_cluster must be replaced -/ resource rancher2_cluster gke_cluster { ~ annotations { node_pools { initial_node_count 1 max_pods_constraint 110 name second-pool version 1.30.11-gke.1157000 autoscaling (known after apply) config (known after apply) # forces replacement management (known after apply) # rancher2_cluster_sync.sync must be replaced -/ resource rancher2_cluster_sync sync { ~ cluster_id c-jstj7 - (known after apply) # forces replacement/code/span/span/spanNote: Any configuration changes on existing nodepools or removing existing nodepools doesnt initiate cluster recreation注意对现有节点池进行任何配置更改或移除现有节点池都不会启动集群重建Resolution 结局The issue is resolved in the Rancher versions v2.10.7, v2.11.3 and v2.12.0, and Rancher2 Terraform provider versions v6.7.0, v7.3.0 and v8.0.0该问题在 Rancher 版本 v2.10.7、v2.11.3 和 v2.12.0 以及 Rancher2 Terraform 提供者版本 v6.7.0、v7.3.0 和 v8.0.0 中得到解决Upgrade to these versions to avoid full cluster recreation when adding node pools.升级到这些版本以避免在添加节点池时重组整个集群。After the fix is applied, as shown in the output, Terraform detects the addition of a new node pool and performs an in-place modification of the rancher2_cluster.gke_cluster.修复完成后如输出所示Terraform 检测到新增节点池并对 rancher2_cluster.gke_cluster 进行原地修改。span stylecolor:#000000span stylebackground-color:#ffffffspan stylebackground-color:#efefefcode # rancher2_cluster.gke_cluster will be updated in-place ~ resource rancher2_cluster gke_cluster { id c-c7mg5 name gke-sh ~ gke_config_v2 { name gke-sh node_pools { initial_node_count 1 max_pods_constraint 110 name second-pool version 1.30.12-gke.1208000 autoscaling (known after apply) config (known after apply) management (known after apply) } rancher2_cluster.gke_cluster: Modifying... [idc-c7mg5] rancher2_cluster.gke_cluster: Modifications complete after 1s [idc-c7mg5] Apply complete! Resources: 0 added, 1 changed, 0 destroyed./code/span/span/spanCause 病因The Rancher2 Terraform provider lacked the granular control necessary to manage individual node pools separately. So it treats the entire list as a single entity. Any change to the node_pools list was interpreted as a complete replacement of the existing configuration, leading to a full cluster replacement.Rancher2 Terraform 提供商缺乏管理单个节点池所需的细致控制。所以它把整个列表当作一个实体来处理。对 node_pools 列表的任何更改都被视为对现有配置的完全替换导致整个集群的替换。访问Rancher-K8S解决方案博主企业合作伙伴 https://blog.csdn.net/lidw2009