Deploy GKE cluster using Terraform

From wikieduonline
Jump to navigation Jump to search

git clone
cd learn-terraform-provision-gke-cluster
terraform init

Change: terraform.tfvar file with name of your cluster

terraform plan (GKE using Terraform)
 terraform plan | grep -w resource
 + resource "google_compute_network" "vpc" {
 + resource "google_compute_subnetwork" "subnet" {
 + resource "google_container_cluster" "primary" {
 + resource "google_container_node_pool" "primary_nodes" {
terraform apply
Apply complete! Resources: 4 added, 0 changed, 0 destroyed.


kubernetes_cluster_host = ""
kubernetes_cluster_name = "your-project-gke"
project_id = "your-project"
region = "us-central1"

Configure credentials to connect:

gcloud container clusters get-credentials $(terraform output -raw kubernetes_cluster_name) --region $(terraform output -raw region)
kubectl get pod -A


See als[edit]