☁ Creating GCP Account, deploying WordPress to launch web app with Load balancer and create SQL DB on Google Cloud Platform ☁

Akanksha Singh
7 min readOct 10, 2020

--

My First Blog on Medium, explaining what google cloud is when it started providing cloud services to their clients and how we can deploy our own application on a server of Google where they might be storing their YouTube, Gmail, google search codes and data. Isn’t it interesting that you are using the Data Centers of Google🤩 …..

From search I found the service of Google Cloud have started 12 yrs ago in 2008 and in a short span of time it have done much for their customers, Everyday Applications like Google Drive, Gmail, YouTube, and many more.

As other Cloud Providers Google Also provides their products in many technologies Like BigData, AI, IOT, Kubernetes etc. The whole manual of Products Could be found at www.cloud.google.com

[🖋] What is Google Cloud Platform?

The Cloud Services provided by Google in Suit (Gsuite) on a Platform Known as GCP (Google Cloud Platform). The best thing about this cloud is it’s availability and Working Standards that are tuning according to the industry requirement like making Projects according to teams, giving privileges to different user.

Infrastructure as a Service, Software as a Service, Platform as a Service, server less computing and different API for services are provided by the GCP.

There are various top notch Cloud Providers and in the following graph given by Gartner we can see Google Cloud Services at the Leaders Quadrant:-

[🖋] Why GCP ?

Any Service with high availability, durability and Scalability are most preferred by the customers. Security is a great Concern with the Performance oriented approach to any of the businesses, even if you go for a free tier account (i.e. $300 free credit) most of the features are provided to you. In the above figure we can find out the answer why Google Cloud and more about it’s features that make it in Leader Quadrant and most used cloud services.

✔ How to create a GCP Account ?

Following are the Screenshots that’ll help you to create GCP account and enable the $300 free credits.

Step 1: Click On console at top right

Step 2: On top right press Activate to activate $300 free GCP Account.

Step 3: Agree the Terms of Service then Continue.

Step 4: Select the account Type then enter the essential information like Credit card you want to attach to the account then start your free trial by proceeding. (Note: 1 Rupee from Indian credit card will be charged for verification purpose).

The process ends up with the creation of Free Tier Account with billing account setup and a default project (named “My First Project”). From now the Services are charged on the basis of “Pay As You Go” model.

Now We need to understand the services that for which purpose which service is to be initialized. Like for compute unit we need to access “Compute Service”, for storage unit “Storage Service”, for creating network we need “Networking Service”, Similarly for Monitoring, Bigdata, Artificial Intelligence and other products. For deploying WordPress to launch web app with Load balancer and create SQL DB.

Performing the Practical Now:-

Step 1: Create multiple projects namely developer and production

Developer Project
Developer Project
Production Project
Production Project

We can create these using Google cloud SDK shell which is just sync with our Google Cloud Platform and create/run/launch any services on cloud in one go just running the specified command. Remember always associate the project with billing account services.

💠 Download the Google Cloud SDK Shell.

Google Cloud SDK Shell
Google Cloud SDK Shell

Then authenticate and Link your Account at once when it direct to the sign in page in chrome.

Authorized to Google Cloud SDK
First Time Login into Shell

Now use commands to get the output direct from your GCP console.

Step 2: Create VPC network for both the projects

Created VPC in developer project
Configuring firewall in developer project
Created VPC in Production project
Configuring firewall in Production project

Step 3: Create VPC network for both the projects

Create VPC Peering in developer project
Create VPC Peering in Production project

Step4: Create a link between both the VPC networks using VPC Peering

by pinging we can see the link made between the two VPC

Step 5: Create a Kubernetes Cluster in developer project and launch any web application with the Load balancer

Step i to create K8S cluster
Step ii to create K8S cluster
Creating node pool in GCP
Configure Node in GCP
Cluster in Developer is created
Connect Cluster using Cmd

For connecting “kubectl” client command must be configured in your system, So that kubernetes cluster can run smoothly taking resources from cloud.

cmd of my system, deploying cluster

Creating a deployment with WordPress Docker Image

WordPress Deployment is made

Now creating Load Balancer in Kubernetes to manage the load over the Kubernetes cluster

creating Load balancer

Now, This step of creating Load Balancer in kubernetes will surprisingly creates the Load Balancer service in GCP:-

The load Balancer Service created one Automatically.

Step 6: Create a SQL server in the production project and create a database

Go to the Storage -> SQL service
Create SQL instance
Create Database
Data base Creation
Data Base Creation
Data Base Creation
Data Base Creation

Connect to MySQL database by doing ssh connection using browser.

Connect to MySQL

Now create a user of Database Application.

User

Step 7: Connect the SQL database to the web application launched in the Kubernetes cluster

Connect to WordPress
The Web Page

The interesting thing about this practical is that this webpage is created using WordPress whose data is stored in MySQL database of GCP and the instances of database and WordPress are managed by Kubernetes Orchestration engine with a Load Balancer to manage the traffic and Scalability required to keep the website up.

This Practical is outcome of my Learning from a GCP Workshop I have attended from LinuxWorld Pvt. Ltd. under the mentorship of Mr. Vimal Daga Sir.

Thankyou for Reading !!

--

--

Akanksha Singh

Platform Engineer | Kubernetes | Docker | Terraform | Helm | AWS | Azure | Groovy | Jenkins | Git, GitHub | Sonar | NMAP and other Scan and Monitoring tool