【问题标题】:GCP Using Compute Engine sole-tenant nodes in GKEGCP 在 GKE 中使用 Compute Engine 单租户节点
【发布时间】:2021-06-21 12:58:46
【问题描述】:

我正在寻找在 GKE 集群中使用唯一租户节点的 terraform 代码。

我在 Google Cloud Docs 上找到了以下参考资料,但在 terraform 中找不到代码。

https://cloud.google.com/kubernetes-engine/docs/how-to/sole-tenancy

这是我要转换的代码的sn-p:

gcloud container node-pools create NODE_POOL_NAME \    
--node-group GROUP_NAME --cluster CLUSTER_NAME \    
--zone COMPUTE_ZONE --machine-type=MACHINE_TYPE \    
--node-locations=COMPUTE_ZONE,COMPUTE_ZONE1

【问题讨论】:

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


    【解决方案1】:

    对于 GCP 唯一租户在节点模板下,您可以查看此内容

    resource "google_compute_node_template" "template" {
      name      = "soletenant-tmpl"
      region    = "us-central1"
      node_type = "n1-node-96-624"
    }
    

    现在将模板添加到节点组

    resource "google_compute_node_template" "soletenant-tmpl" {
      name      = "soletenant-tmpl"
      region    = "us-central1"
      node_type = "n1-node-96-624"
    }
    
    resource "google_compute_node_group" "nodes" {
      name        = "soletenant-group"
      zone        = "us-central1-a"
      description = "example google_compute_node_group for Terraform Google Provider"
      maintenance_policy = "RESTART_IN_PLACE"
      size          = 1
      node_template = google_compute_node_template.soletenant-tmpl.id
      autoscaling_policy {
        mode      = "ONLY_SCALE_OUT"
        min_nodes = 1
        max_nodes = 10
      }
    }
    

    您可以查看:https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_node_group

    【讨论】:

    • 嗨,Harsh,我已经实施到这里。我正在寻找要在单租户组内创建的 GKE 集群节点。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-26
    • 2021-04-14
    • 1970-01-01
    • 2021-04-20
    相关资源
    最近更新 更多