Creating your first GKE cluster using Terraform involves defining infrastructure as code for Kubernetes clusters on Google Cloud Platform:
Define Configuration: Write Terraform code specifying GKE cluster details, such as node pools, machine types, and Kubernetes version.
Deployment: Execute terraform init to initialize, terraform plan to preview changes, and terraform apply to create the cluster.
Cluster Provisioning: Terraform automates provisioning of GKE resources, including networking, nodes, and Kubernetes control plane.
some google cloud account, we are going to use credentials.json
to authenticate in this demo.
ref: https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference
- terraform
- gcp account
export GOOGLE_APPLICATION_CREDENTIALS=credentials.json
terraform init
terraform plan
terraform apply
uncomment kubernetes.tf
content to apply kubernetes manifest to cluster and apply again
## review cluster in GCP CONSOLE
check gke cluster from GCP console
kubectl apply -k github.com/stefanprodan/podinfo//kustomize
terraform destroy
this apply is only needed at my account because my current setup.
terraform apply --target=google_project_service.gke
`
``