【问题标题】:Cloud Run For Anthos With Terraform使用 Terraform 为 Anthos 运行 Cloud Run
【发布时间】:2021-12-30 16:40:50
【问题描述】:

我们想要实现的是在Google Cloud Platform 中创建一个启用Cloud Run 插件的Kubernetes 集群;然后使用自定义 helm chart 版本实例化集群,所有这些都通过 Terraform

从 terraform 文档中,只展示了如何创建 kubernetes 集群,而不是如何安装Cloud Run

resource "google_container_cluster" "primary" {
    name     = "my-gke-cluster"
    location = "us-central1"

    # We can't create a cluster with no node pool defined, but we want to only use
    # separately managed node pools. So we create the smallest possible default
    # node pool and immediately delete it.
    remove_default_node_pool = true
    initial_node_count       = 1
}

resource "google_container_node_pool" "primary_preemptible_nodes" {
    name       = "my-node-pool"
    location   = "us-central1"
    cluster    = google_container_cluster.primary.name
    node_count = 1

    node_config {
        preemptible  = true
        machine_type = "e2-medium"

        # Google recommends custom service accounts that have cloud-platform scope and permissions granted via IAM Roles.
        service_account = google_service_account.default.email
        oauth_scopes    = [
        "https://www.googleapis.com/auth/cloud-platform"
        ]
    }
}

为了让 terraform 创建一个在主节点中安装了 Istio 和 KNative 的集群,我们应该进行哪些更改

【问题讨论】:

    标签: google-cloud-platform google-kubernetes-engine terraform-provider-gcp helm3 google-anthos


    【解决方案1】:

    您可以将addons_config 块与cloudrun_config 块一起使用:

    addons_config {
      cloudrun_config {
        disabled = false
      }
    }
    

    或者,如果您想为 CloudRun 使用内部负载均衡器,那么

    addons_config {
      cloudrun_config {
        disabled = false
        load_balancer_type=LOAD_BALANCER_TYPE_INTERNAL
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2021-09-03
      • 2021-01-05
      • 2021-09-15
      • 2020-04-26
      • 2020-05-20
      • 2022-10-12
      • 1970-01-01
      • 2021-08-03
      • 2022-10-07
      相关资源
      最近更新 更多