Kubernetes on Google cloud

In this blog, I will cover the steps to run Kubernetes on Google compute VM. I used the steps mentioned here.


  • Need Google cloud account.
  • Install Google cloud SDK.

First step is to download and unzip Kubernetes tar file from here.
Next, we create the cluster using the provided script.


The above script creates the clusters with 1 master and 4 minions. Also, it sets up all necessary services both in master and minions node.
Lets look at the VMs created:

$ gcloud compute instances list
kubernetes-minion-wsh1 us-central1-b n1-standard-1 RUNNING
kubernetes-minion-ojzz us-central1-b n1-standard-1 RUNNING
kubernetes-minion-or9g us-central1-b n1-standard-1 RUNNING
kubernetes-minion-8r0f us-central1-b n1-standard-1 RUNNING
kubernetes-master      us-central1-b n1-standard-1  RUNNING

Lets create a nginx pod with 2 replicas:

# run container
cluster/kubectl.sh run-container my-nginx --image=dockerfile/nginx --replicas=2 --port=80

Get list of pods:

$ cluster/kubectl.sh get pods
current-context: "eighth-keyword-474_kubernetes"
Running: cluster/../cluster/gce/../../platforms/linux/amd64/kubectl get pods
POD                                          IP                  CONTAINER(S)            IMAGE(S)                            HOST                                                    LABELS                                                                      STATUS              CREATED                                                                                                                                                          
my-nginx-i7hvs                                                   my-nginx                dockerfile/nginx                    kubernetes-minion-wsh1.c.eighth-keyword-474.internal/   run-container=my-nginx                                                      Unknown             4 minutes
my-nginx-nyxxv                                                   my-nginx                dockerfile/nginx                    kubernetes-minion-or9g.c.eighth-keyword-474.internal/   run-container=my-nginx                                                      Unknown             4 minutes

We should be able to access the webserver now.

Lets delete the pods:

# stop pod
cluster/kubectl.sh stop rc my-nginx
# Delete pod
cluster/kubectl.sh delete rc my-nginx

Lets delete the cluster:

# bringdown cluster

For guestbook application, we can follow the procedure here. This application has multiple pods and services.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s