【发布时间】:2020-04-13 09:17:24
【问题描述】:
我对 GKE 上的节点池的 terraform 代码进行了更改,我只更改了与节点池关联的标签,然后它拆除了整个集群(包括主集群)并重新创建了它。现在,每次我尝试对集群进行更改时,无论大小,terraform 都希望拆除并重新创建整个集群。
我们使用 Terraform Cloud 来管理集群。
我在几个实例组的提交中做了这样的事情:
labels = {
- role = "nodes"
+ "kops.k8s.io/instancegroup" = "nodes"
这些是相应地形计划的前几行:
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement
Terraform will perform the following actions:
# module.kubernetes.google_container_cluster.master must be replaced
-/+ resource "google_container_cluster" "master" {
我能想到的唯一可能导致此问题的事情是,我之前的一些提交修改了实例组的范围,以便它们可以从 Google 存储中读取和写入,但这些更改已应用于所有实例集群中的组。
找到解决方案:
上面描述的是与此人类似的问题: https://github.com/gruntwork-io/terraform-google-gke/issues/59
解决方案是将ignore_changes 添加到我们的主配置中,如下所示:
https://github.com/gruntwork-io/terraform-google-gke/pull/60/files
【问题讨论】:
-
你能把你的编辑变成答案吗
-
正如我的@Patrick 建议的那样,请随时提供您的解决方案作为答案,以便其他社区成员可以利用它。
标签: google-kubernetes-engine terraform-cloud