Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kubernetes 使用Terraform提供GKE如何防止google_容器_集群资源扩展_Kubernetes_Google Cloud Platform_Terraform_Google Kubernetes Engine - Fatal编程技术网

Kubernetes 使用Terraform提供GKE如何防止google_容器_集群资源扩展

Kubernetes 使用Terraform提供GKE如何防止google_容器_集群资源扩展,kubernetes,google-cloud-platform,terraform,google-kubernetes-engine,Kubernetes,Google Cloud Platform,Terraform,Google Kubernetes Engine,我有一个工作的terraform声明,其中有一个google_容器_集群和一个google_容器_节点_池 当我的kubectl部署对节点造成压力时,另一个google_容器_节点_池会自动生成 如何控制此[每个群集限制一个或n个节点池] 我只能找到一种方法来限制节点池中的节点,它们的最小值和最大值设置为1 resource "google_container_node_pool" "rtp_container_cluster_node_pool" { name = "node-pool"

我有一个工作的terraform声明,其中有一个google_容器_集群和一个google_容器_节点_池

当我的kubectl部署对节点造成压力时,另一个google_容器_节点_池会自动生成

如何控制此[每个群集限制一个或n个节点池]

我只能找到一种方法来限制节点池中的节点,它们的最小值和最大值设置为1

resource "google_container_node_pool" "rtp_container_cluster_node_pool" 
{
  name = "node-pool"
  zone = "${var.zone}"
  cluster = "${google_container_cluster.rtp_container_cluster.name}"

  node_config {
    machine_type = "${var.machine_type_node}"
    disk_size_gb = "${var.disk_size_gb_node}"
    local_ssd_count = "${var.local_ssd_count_node}"
    oauth_scopes = "${var.oauth_scopes}"
  }


  # Autoscale
  autoscaling {
    min_node_count = "${var.minNodeCount_node}"
    max_node_count = "${var.maxNodeCount_node}"
  }
}



resource "google_container_cluster" "rtp_container_cluster" {
  name = "${var.container_cluster_name}-master"
  zone = "${var.zone}"
  initial_node_count = "${var.cluster_count}"
  additional_zones = "${var.additional_zones}"
  network = "${var.network}"
  subnetwork = "${var.subnetwork}"
  enable_kubernetes_alpha = "${var.enable_kubernetes_alpha}"
  min_master_version = "${var.min_master_version}"

  master_auth {
    username = "${var.username}"
    password = "${var.password}"
  }

  node_config {
    machine_type = "${var.machine_type}"
    disk_size_gb = "${var.disk_size_gb}"
    local_ssd_count = "${var.local_ssd_count}"
    oauth_scopes = "${var.oauth_scopes}"
    tags = "${var.tags}"

    labels {
      purpose = "dev-rtp-poc-cluster"
    }
  }

  addons_config {
    http_load_balancing {
      disabled = "${var.http_load_balancing_disable}"
    }

    horizontal_pod_autoscaling {
      disabled = "${var.horizontal_pod_autoscaling_disable}"
    }
  }

}自动缩放在节点池级别工作。GKE中没有自动创建新节点池的系统。如果您只希望每个集群有一个节点,我建议您将初始节点数设置为“1”,并完全禁用自动缩放,因为在您的用例中不需要自动缩放。

现在GKE中有一个创建节点池的系统,可以从terraform配置该系统;