My scrapbook about almost anything I stumble upon in my tech world. If you find anything useful don't forget to give thumbs-up :)


Tuesday, January 5, 2021

Step by Step Google Kubernetes Engine (GKE) - I

In this post series, I will be exploring Google Kubernetes Engine aka GKE service on Google Cloud Platform. GKE service is Google managed K8s one click clusters so that we can quickly start with our application without hassling with infrastructure.  We will go step by step process so tag along from where-ever you are comfortable. I am not going into too basics like what is Kubernetes aka K8s and all, we will keep these topics for some another post. 

  • Very first step to login on  with your gmail id, if you don't have any gmail id, create it.
  • When you login on  very first time, you need to setup your account by providing your details and credit card details for billing purpose, don't worry when you provide your credit card as Google does not charge on until you allow it manually after the trial period end. 
  • Once, you have setup your account, Google by default create a project, but we will create another project - gkelearn
  • Click on New Project and fill out the details, you can give any name, project id will be auto generated so dont change it. Leave Organization as it is. 
  • Click on Create. Your Google Project will be like somewhat below screenshot -

  • Our GCP project has been setup, Now, we will create K8s Clusters. On the same maine dashboard, at left bottom screen you will see "Kubernetes Engines" under COMPUTE section, Select Clusters as below image -
  • Once click on clusters, GCP ask for basic cluster details, we are going to create everything default, no need to tweak as we are learning here. For development or production ready clusters requires serious configuration of K8s clusters. So, simply click on Create at page bottom.
  • It will take few mins to create a GKE cluster, Once created, it will look like below - 
  • To connect to K8s Cluster, Click on "Connect" button. This will give you the command to connect. You can either use GCP Cloud Shell or use your CMD/Terminal if installed the gcloud binary in your system/computer. Let's click on "Cloud Shell"
  • This will open a shell in browser only and the connect command will run. It will ask for authorization, Kindly allow. 
  • You can run below commands to check if Project is correct, though you can see the project name in bracket () and if k8s is up.
    $ gcloud config list project 
    $ kubectl cluster-info
  • our K8s cluster has been setup and running successfully, we will continue this journey with next post. 
**Before logging out from, shutdown the cluster to avoid the unnecessary billing on idle cluster. 

gcloud container clusters resize [CLUSTER-NAME] --num-nodes=0 --zone=[ZONE-NAME]
i.e - gcloud container clusters resize cluster-1 --num-nodes=0 --zone=us-central1-c

This will take some time, once done, your cluster details will look like below, just remember whenever you want to work on it, you need to scale this up with above command just change the num-nodes value. 

Like the below page to get the update  
Facebook Page      Facebook Group      Twitter Feed      Telegram Group

No comments:

Post a Comment


The postings on this site are my own and don't necessarily represent IBM's or other companies positions, strategies or opinions. All content provided on this blog is for informational purposes and knowledge sharing only.
The owner of this blog makes no representations as to the accuracy or completeness of any information on this site or found by following any link on this site. The owner will not be liable for any errors or omissions in this information nor for the availability of this information. The owner will not be liable for any losses, injuries, or damages from the display or use of his information.