地形:创建单节点GKE集群

时间:2019-11-23 04:44:58

标签: kubernetes google-cloud-platform terraform google-kubernetes-engine

我正在尝试创建一个节点大小为1的GKE群集。但是,它总是创建一个3个节点的群集。这是为什么?

resource "google_container_cluster" "gke-cluster" {
  name = "sonarqube"
  location = "asia-southeast1"
  remove_default_node_pool = true
  initial_node_count = 1
}

resource "google_container_node_pool" "gke-node-pool" {
  name = "sonarqube"
  location = "asia-southeast1"
  cluster = google_container_cluster.gke-cluster.name
  node_count = 1

  node_config {
    machine_type = "n1-standard-1"
    metadata = {
      disable-legacy-endpoints = "true"
    }

    labels = {
      app = "sonarqube"
    }
  }
}

enter image description here

1 个答案:

答案 0 :(得分:0)

好吧,发现我可以使用node_locations

resource "google_container_cluster" "gke-cluster" {
  name = "sonarqube"
  location = "asia-southeast1"
  node_locations = [
    "asia-southeast1-a"
  ]
  remove_default_node_pool = true
  initial_node_count = 1
}

否则,GKE似乎将为每个区域创建1个节点。