less than 1 minute read

Introduction

I have promised to write an article about spinning up Kubernetes cluster on GCP in my last article a year ago, I had time to test with an free GCP account, it is a quite interesting learning.

Setup Kubernetes cluster on GCP

Main process is very similar as on AWS, In GCP you need to first create a project and configure your service account under the project, then you will have access to gcloud service with gloud cli tool.

1
2
3
4
5
6
7
8
#create project
gcloud projects create gke-terragrunt-demo
gcloud config set project gke-terragrunt-demo
#configure service account
gcloud iam service-accounts create terragrunt-sa --display-name="Terragrunt service account"
gcloud projects add-iam-policy-binding gke-terragrunt-demo --member='serviceAccount:terragrunt-sa@gke-terragrunt-demo.iam.gserviceaccount.com' --role='roles/admin'
gcloud iam service-accounts keys create ~/.gcloud/key.json --iam-account=terragrunt-sa@gke-terragrunt-demo.iam.gserviceaccount.com
gcloud auth activate-service-account --key-file ~/.gcloud/key.json

For the terraform part, we can just use existing GKE terraform module on github, they also offer various usage examples, you can checkout here. The rest of setups are documented in my git repository