Getting Started with Google Cloud Platform

Azeemushan Ali
6 min readSep 9, 2020

What is GCP?

Google Cloud Platform (GCP), offered by Google, is a suite of cloud computing services that run on the same infrastructure that Google uses internally for its end-user products, such as Gmail and YouTube. Alongside a set of management tools, it provides a series of modular cloud services including computing, data storage, data analytics and machine learning.

We require OS, RAM, storage to run our application. For this, we need an IT infrastructure. But nowadays companies don’t want to invest over upfront. So we have some companies that provide services, they work on model: pay-as-you-go. And we outsource these services from such service providers as these companies are specialized in IT infrastructure management. The technology they use for providing services is Cloud Computing.

Before moving on further with the task let us first understand the agenda.

1. Create a project.

2. Inside the project create two VPC one in the US and the other in Singapore.

3. Create a VPC peering between the two VPCs.

4. Inside one VPC launch a Kubernetes cluster and in the other launch MySql instance.

5. Launch WordPress on the Kubernetes cluster.

1. Create a project.

In GCP we have to create a project first to start using any resources. By default, they create a project for us. As normally in an organization work on certain teams who work on different stages to launch a product. And each team has its own environment and we can set different quotas and billing accounts, limits etc. And in google, these teams are known as Projects. Projects are just for management purposes as it is a great way to manage resources.

2. Inside the project create two VPC one in the US and the other in Singapore.

GCP offers Networking as a Service through VPC. It is a great way to manage our environment as we can customize everything from IP address to region on our according. This is a virtual network which we define.

Firstly we are creating VPC for WordPress in the US(east-1)

Then we create VPC for our database in Singapore (asia southeast-1)

3. Create a VPC peering between the two VPCs.

A VPC peering connection is a networking connection between two VPCs that enables you to route traffic between them using private IPv4 addresses or IPv6 addresses. So, to connect both the VPCs we have to do the VPC peering from both the VPCs.

First, we are creating peering from database VPC

GCP provides number of ways to connect to this API. Here we are using SDK to connect to this API.

Follow the below-given steps to install SDK:

4. Inside one VPC launch a Kubernetes cluster and in the other launch MySql instance.

GCP gives Kubernetes as a service through Google Kubernetes Engine (GKE) product where we get a fully managed master (which has high availability), And we just have to give configurations for slave nodes and the whole cluster is managed by the service provider.

Follow the below-given steps to create a cluster by providing appropriate node pool, node and network details.

Here a regional cluster named cluster-1 has been created in us east-1 region. Click on Connect to establish a connection with the cluster.

Now, why we have created a regional cluster?

In Regional cluster, the node pools are launched at different data centre/ zone of a particular region. It is better in terms of disaster recovery.

Now to connect to your cluster we need to download kubectl command in our CLI. Kubectl helps to connect to your master node and give commands to further use the cluster resources.

5.Deployment of Application on K8s cluster

Click on Connect to establish a connection with the cluster. And run the given commands. Also, we can see the nodes created.

Now we are creating our WordPress deployment through the following command.

6.Creation of MySql instance

We need a Database to store the data of our web-app.In GCP, for the database as a service to store information in rows and columns, we have SQL. It gives us a fully managed database. Here, we used SQL to create the database.

Now click on create and our instance is created.

From here now we will create a new database for WordPress and add a user to the database.

Here, we can see that our database is created.

7.Creation of load balancer

GCP gives its independent service of load balancing that is LB (load balancer). Kubernetes cluster internally uses this external load balancer to expose the pods in the cluster and also manages ingress traffic.

Here we can see a load balancer is created with an IP which can be used by clients to access WordPress.

Now using the external IP of our load balancer we can connect to our application and its data will be stored in the Database instance we created.

After this we need to give the user details we created at the time of MySql instance launch:

Our WordPress is connected to our database and is launched successfully.Do like the article and connect with me on Linkedin !!

Thank you Everyone for reading .!! Bella Ciao

--

--