2

我对 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

4

1 回答 1

1

我把我的编辑放到这个答案中:

上面描述的是与此人类似的问题:https ://github.com/gruntwork-io/terraform-google-gke/issues/59

解决方案是将 ignore_changes 添加到我们的主配置中,如下所示:https ://github.com/gruntwork-io/terraform-google-gke/pull/60/files

于 2020-01-03T00:07:21.847 回答