我正在尝试使用Terraform Module for GKE,但不确定如何配置属性ip_range_pods
和ip_range_services
。
具体来说,我不确定它们如何得出这些值:
ip_range_pods = "us-central1-01-gke-01-pods"
ip_range_services = "us-central1-01-gke-01-services"
答案 0 :(得分:3)
ip_range_pods
和ip_range_services
映射到google_container_cluster
资源的ip_allocation_policy
cluster_secondary_range_name
和cluster_secondary_range_name
属性,如{{ 3}}:
resource "google_container_cluster" "zonal_primary" {
# ...
ip_allocation_policy {
cluster_secondary_range_name = "${var.ip_range_pods}"
services_secondary_range_name = "${var.ip_range_services}"
}
}
这些必须是子网中现有的范围,例如the module source创建的范围:
resource "google_compute_subnetwork" "network-with-private-secondary-ip-ranges" {
name = "test-subnetwork"
ip_cidr_range = "10.2.0.0/16"
region = "us-central1"
network = "${google_compute_network.custom-test.self_link}"
secondary_ip_range {
range_name = "tf-test-secondary-range-update1"
ip_cidr_range = "192.168.10.0/24"
}
}
resource "google_compute_network" "custom-test" {
name = "test-network"
auto_create_subnetworks = false
}