Skip to content

Latest commit

 

History

History
85 lines (55 loc) · 1.94 KB

create-gke-cluster.md

File metadata and controls

85 lines (55 loc) · 1.94 KB

Create an Google Cloud Platform Cluster

Pre-requisites

This assumes that you already have a Google Cloud Platform account and have created and selected a project with the necessary services enabled

Create Google Cloud Platform SDK config

gcloud init
gcloud auth application-default login

Create GCP GKE Cluster

Option 1: Create using command line tools (locally)

  • Create the Kubernetes cluster (this will take a few minutes)
gcloud container clusters create <cluster-name> --cluster-version=1.16 \
  --num-nodes=30 \
  --no-enable-autoupgrade
  --enable-autoscaling
  --min-nodes 15 
  --max-nodes 50
  • After the cluster has completed, verify that there are 3 nodes running:
gcloud compute instances list
  • Generate a kubeconfig entry that uses gcloud for authentication
gcloud container clusters get-credentials <cluster-name> --zone <zone> --project <project>

Option 2: Create GKE cluster using Terraform

Clone the cluster-baseline repository:

git clone git@github.com:CloudNativeGBB/cluster-baseline.git
cd cluster-baseline/infrastructure/gcp
  • Verify that Terraform is >= 0.13.2
terraform version
  • Open terraform.tfvars and replace the default values with your project_id, region, and cluster_name

  • Initialize Terraform

terraform init
  • To see any changes in advance that are required for your infrastructure, use terraform plan.

  • Create the cluster using Terraform templates

terraform apply
  • Generate a kubeconfig entry that uses gcloud for authentication
gcloud container clusters get-credentials <cluster-name> --zone <zone> --project <project>