In this article, will show you how to setup GCP Kubernete (GKE). Probably you’re looking for the public cloud platform to host containerized application.

To avoid provision or manage baseline infrastructure, google kubernetes engine service helps business to save time, cost and gives on demand platform to host and mange containerized applications in just few clicks.

If you’re familiar with kubernetes and google cloud platform (GCP), then tutorial going to be useful to start from scratch.

So let’s explore more about “Google kubernetes configuration in public cloud environment”.

Prerequisites

1- Google Cloud Platform– You can use google cloud free tier to perform this activity, or free to use paid account.

2- Google Cloud Platform SDK– GCP SDK on your local machine, if you haven’t, follow the Google Cloud SDK documentation to install and configure the gcloud command line utility.

Once SDK setup done, Verify the SDK version using the following command.

gcloud version

Terminal Output–

C:>gcloud version
Google Cloud SDK 312.0.0
bq 2.0.61
core 2020.09.25
gsutil 4.53

3- Connect GCP- Once SDK tool installed on your local machine, run the init command and follow the login option from terminal.

gcloud init

4- Set a Default Compute Region and Zone– If you have already set a default compute region and zone, then you can ignore step-4 else run the following commands-

gcloud config set compute/region us-central1 # Region setup
gcloud config set compute/zone us-central1-a # Zone setup

Now our base setup is ready to install Client tools to configure Kubernetes in GCP.

Install the kubectl Tool

To set up kubernetes, you need a client tool called kubectl. If you already have it, no action needs to perform, else follow the installation documents.

When kubectl tool setup done and PATH set in environment variables, verify its version, using following command.

kubectl version --client
C:>kubectl version --client
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.0", GitCom
mit:"e19964183377d0ec2052d1f1fa930c4d7575bd50", GitTreeState:"clean", BuildDate:
"2020-08-26T14:30:33Z", GoVersion:"go1.15", Compiler:"gc", Platform:"windows/amd
64"}

Provision Kubernetes Cluster

There are various types of Cluster configuration in GCP. But we will create a zonal Kubernetes Cluster in Google Cloud using following commands to create kubernetes-demo cluster.

gcloud container clusters create kubernetes-demo(cluster name)

kubernetes-demo is cluster name in my case, but you can choose as per your infrastructure naming standard and wait for 2-5 minutes to complete the deployment.

Once deployment will complete, you will see terminal output and newly created kubernetes cluster details in GCP console.

Terminal Output

kubernete cluster

Console Output– Go to GCP console— Kubernetes engine

kubernete console

Verify the Kubernetes cluster configuration

1- View clusters in your selected zone using following command-

gcloud container clusters list

2- Viewing kubeconfig to view the kubeconfig file contents.

kubectl config view

That’s all. Your kubernetes cluster setup is ready to host your application. I hope, this article help you to configure your first GCP kubernetes cluster.