In this article, we are going to see how to create a Kubernetes Cluster into Google Container Engine. By the end of it, a user will have two node cluster up and running.


In order to create a Kubernetes Cluster, a user requires at least one project in Google Cloud Platform. This allows a user to use Google Container Engine resource. After creating a project, a user gets project information on Google Console as shown in fig.(1)


Fig. (1) Project Information

Google cloud shell

Google Cloud Shell provides command-line access to cloud resources directly from a user’s browser so that a user can easily manage projects and resources without installing the Google Cloud SDK or other tools on their system. With Cloud Shell, a user has access to the gcloud command-line tool.

To activate Google Cloud Shell,

  • Select a project from the Google Cloud Dashboard
  • Click on the ‘Google Cloud Shell’ button

It should take a few minutes to provision and connect with the environment.

Afterwards, a user will see the cloud shell as shown in fig.(2)


Fig. (2) Google Cloud Shell

Create Google Container Engine cluster

There are two methods to create a Cluster:

  1. gcloud command-line tool
  2. Google Cloud Platform console
1. Cluster Creation via gcloud command-line tool

Use following gcloud command to create a Cluster

gcloud container clusters create demo –disk-size 100 –zone asia-southeast1-b –machine-type n1-standard-2 –num-nodes 2


To create a highly available multi-zone (one region) Kubernetes cluster on GKE, use the following command

gcloud container clusters create kubernetes-lab1 –disk-size 100 –zone asia-southeast1-b –additional-zones asia-southeast1-a –machine-type n1-standard-2 –num-nodes 2


Both the commands will help a user create a Kubernetes cluster with two nodes (one node per zone). All nodes share the same master and workload will be spread evenly across two nodes.


2. Cluster Creation via Google Cloud Platform console

Let’s create a cluster with two nodes into asia-southeast1-b zone using the console.

Go to ‘Container Engine’ page and select ‘Create a container cluster’.

Fig. (3) Creating a Container Cluster – Step 1

A user should then see the page as shown in fig.(4). Add Cluster Name, Zone and Node Size as per the requirement.

Fig. (4) Creating a Container Cluster – Step 2


Once a user is done entering the information, click on the ‘Create’ button. This will take a few minutes to complete.

When it’s completed, a user will see the cluster information as shown in Fig.(5)


Fig. (5) Viewing Container Clusters


At this point, Container Engine has created Compute Engine instances that can be viewed in the ‘VM Instances’ section as shown in fig.(6). The instances are nodes of the Container Engine cluster.

Fig. (6) Viewing Instances in the Cluster


The user now has a Kubernetes cluster on Google Container Engine.

For configuring the kubectl command locally, the user has to set the default project id, zone and cluster name using the following commands

gcloud config set project PROJECT_ID
gcloud config set compute zone asia-southeast1-b
gcloud config set container cluster demo


Also, fetch the cluster credentials for the kubectl tool as follows

gcloud container clusters get-credentials demo –zone asia-southeast1-b –project <project_ID>


Then start a proxy to view the Kubernetes Dashboard on the local browser

kubectl proxy &

Open the Dashboard using the following URL


Fig. (7) Kubernetes Dashboard


Get the cluster info using the following command:

kubectl cluster-info


Fig. (8) Cluster Information



We have learned how to use Google Cloud Shell, turn on the relevant APIs and spun up a Kubernetes cluster on Google Container Engine. Container Engine is fully managed by Google reliability engineers, ensuring cluster is available and up-to-date, including both auto-upgrading and auto-repairing master and nodes. It can help a user automatically scale up and down his application based on the resource utilisation.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Reload Image