Kubernetes Cluster

The first step is to create a cluster to work with. We will create a Kubernetes cluster using Google Kubernetes Engine.

Everything on GCP is operated with API (even from the console!). Enable the Google Cloud Platform APIs so that you can create a Kubernetes cluster.

gcloud services enable \
  compute.googleapis.com \
  container.googleapis.com \
  containerregistry.googleapis.com

Set default region and zones.

gcloud config set compute/zone us-east1-d
gcloud config set compute/region us-east1

For the lab, use the region/zone recommended by the instructor. Learn more about different zones and regions in Regions & Zones documentation.

Create a Kubernetes cluster in Google Cloud Platform is very easy! Use Kubernetes Engine to create a cluster:

gcloud container clusters create guestbook \
  --num-nodes 4 \
  --scopes cloud-platform

While this goes on you might enjoy watching this short video.

This will take a few minutes to run. Behind the scenes, it will create Google Compute Engine instances, and configure each instance as a Kubernetes node. These instances don’t include the Kubernetes control plan nodes. In Google Kubernetes Engine, the Kubernetes control plane is a managed service so that you don’t have to worry about it!

The scopes parameter is important for this lab. Scopes determine what Google Cloud Platform resources these newly created instances can access. By default, instances are able to read from Google Cloud Storage, write metrics to Google Cloud Monitoring, etc. For this lab, we use the cloud-platform scope to give us more privileges, such as writing to Cloud Storage as well.

Last updated

Was this helpful?