Terraform을 사용하여 Google Kubernetes Engine Autopilot 클러스터 만들기
6085 단어 terraformgooglecloudkubernetes
다음 리소스가 생성됩니다.
GKE Autopilot 클러스터
GKE Autopilot 클러스터는 웹 서브넷에서 호스팅됩니다. 퍼블릭 API 서버 엔드포인트는 특정 범위의 IP 주소에서만 액세스할 수 있습니다.
terraform 파일infra/plan/gke.tf
을 만듭니다.
resource "google_container_cluster" "private" {
provider = google-beta
name = "private"
location = var.region
network = google_compute_network.custom.name
subnetwork = google_compute_subnetwork.web.id
private_cluster_config {
enable_private_endpoint = false
enable_private_nodes = true
master_ipv4_cidr_block = var.gke_master_ipv4_cidr_block
}
master_authorized_networks_config {
dynamic "cidr_blocks" {
for_each = var.authorized_source_ranges
content {
cidr_block = cidr_blocks.value
}
}
}
maintenance_policy {
recurring_window {
start_time = "2021-06-18T00:00:00Z"
end_time = "2050-01-01T04:00:00Z"
recurrence = "FREQ=WEEKLY"
}
}
# Enable Autopilot for this cluster
enable_autopilot = true
# Configuration of cluster IP allocation for VPC-native clusters
ip_allocation_policy {
cluster_secondary_range_name = "pods"
services_secondary_range_name = "services"
}
# Configuration options for the Release channel feature, which provide more control over automatic upgrades of your GKE clusters.
release_channel {
channel = "REGULAR"
}
}
파일 완성infra/plan/variable.tf
:
variable "gke_master_ipv4_cidr_block" {
type = string
default = "172.23.0.0/28"
}
클러스터를 배포합시다
cd infra/plan
gcloud services enable container.googleapis.com --project $PROJECT_ID
terraform apply
클러스터가 생성되었고 올바르게 작동하는지 확인해 보겠습니다.
GKE Autopilot 클러스터
결론
이제 GKE 클러스터가 활성화되었습니다. 에서는 Cloud SQL 인스턴스 설정에 중점을 둘 것입니다.
Reference
이 문제에 관하여(Terraform을 사용하여 Google Kubernetes Engine Autopilot 클러스터 만들기), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://dev.to/stack-labs/creating-a-google-kubernetes-engine-autopilot-cluster-using-terraform-1l22
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
resource "google_container_cluster" "private" {
provider = google-beta
name = "private"
location = var.region
network = google_compute_network.custom.name
subnetwork = google_compute_subnetwork.web.id
private_cluster_config {
enable_private_endpoint = false
enable_private_nodes = true
master_ipv4_cidr_block = var.gke_master_ipv4_cidr_block
}
master_authorized_networks_config {
dynamic "cidr_blocks" {
for_each = var.authorized_source_ranges
content {
cidr_block = cidr_blocks.value
}
}
}
maintenance_policy {
recurring_window {
start_time = "2021-06-18T00:00:00Z"
end_time = "2050-01-01T04:00:00Z"
recurrence = "FREQ=WEEKLY"
}
}
# Enable Autopilot for this cluster
enable_autopilot = true
# Configuration of cluster IP allocation for VPC-native clusters
ip_allocation_policy {
cluster_secondary_range_name = "pods"
services_secondary_range_name = "services"
}
# Configuration options for the Release channel feature, which provide more control over automatic upgrades of your GKE clusters.
release_channel {
channel = "REGULAR"
}
}
variable "gke_master_ipv4_cidr_block" {
type = string
default = "172.23.0.0/28"
}
cd infra/plan
gcloud services enable container.googleapis.com --project $PROJECT_ID
terraform apply
이제 GKE 클러스터가 활성화되었습니다. 에서는 Cloud SQL 인스턴스 설정에 중점을 둘 것입니다.
Reference
이 문제에 관하여(Terraform을 사용하여 Google Kubernetes Engine Autopilot 클러스터 만들기), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/stack-labs/creating-a-google-kubernetes-engine-autopilot-cluster-using-terraform-1l22텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)