How to set up Kubernetes cluster on GCP | Inkoop Blog

How to set up Kubernetes cluster on GCP - Google Cloud. In-depth detail on setting up kubernetes on GCP. We provide Kubernetes + Docker DevOps service.

Posted by Naveen on 20 Feb 2018

DevOps??? Containers???

Hell yes, Kubernetes!!!

Well, if you were thinking of DevOps, in all probability you might think of Kubernetes and of course Google the giant contributor.

Kubernetes ( K8s ) is open source and container orchestration tool.

Lets not get deeper into Kubernetes.

We will see how to set up Kubernetes cluster or Google Kubernetes Engine on GCP (Google Cloud Provider).

I assume you have a Google account and have gcloud set in your local machine.

If not please follow the steps here for macOs and quickstart-debian for ubuntu and initialize the SDK.

To set a default project, run the following command, this is the project under which the cloud resources will be created.

gcloud config set project Inkoop-kubernetes

Inkoop-kubernetes is my PROJECT_ID, you should be able to get one if you have created one already.

To set a default compute zone

gcloud config set compute/zone [COMPUTE_ZONE]

We are set!!! Let’s create a kubernetes cluster with 3 nodes.

Before that make sure you have kubectl installed.

gcloud components install kubectl

This command installs kubectl components on your local machine.

gcloud container clusters create Inkoop-kubernetes-cluster \
  --disk-size 300 \
  --zone us-east1-b \
  --enable-cloud-logging \
  --enable-cloud-monitoring \
  --machine-type n1-standard-2 \
  --num-nodes 3

Sit back and relax, this will take a while!!

Inkoop-kubernetes-cluster is my CLUSTERNAME you can name yourCompany-kubernetes or **anythingyou_like**!!

Cool isn’t it??

Here i am creating a cluster with nodes 3 of size n1-standard-2 with disk-size 300 with logging and monitoring enabled!!!

After creating your cluster, you need to get authentication credentials to interact with the cluster and this line would help you with that.

gcloud container clusters get-credentials Inkoop-kubernetes-cluster

make sure your local config is set to proper project where your cluster is created!! Or

You could run:

gcloud config set project inkoop


gcloud container clusters get-credentials Inkoop-kubernetes-cluster

Now we are good to talk to you cluster!!

# Check how the cluster looks!!
kubectl cluster-info


# List all the nodes
kubectl get nodes


# With more details
kubectl get nodes -o wide


Congrats!! You have your Kubernetes cluster up and running!!!

Contact us to setup your kubernetes instance.

Naveen Kumar

Have a Project in mind?