Google Cloud Platform (GCP)…

Nithish Kumar
6 min readAug 25, 2020
… GCP …

😊 Hello Everyone,
✨ In this post, I would like to share the practical what I have done in Two days Workshop under the guidance of Vimal Daga sir…

😎 Vimal sir given a task which is a industry level use case… Take FB as an example, we have used it so many times. But we don’t know where it stores our data and where the webapp / webserver is running … Assume that for webapp FB is using wordpress and for storing the data it is using MySQL..
Now this same kind of scenario I am going to create using Google Cloud Platform …

🏄 Follow these steps to create that scenario …

🔰 Step 1: Create two VPCs in two diff. regions …
👉 In the first VPC, I’m going to create a webserver on the top of Kubernetes Cluster …
👉 In second VPC, I’m going to create the Database Server…
👉 Go to GCP Console and then click on VPC Network and u will landed on this below page

👉 Click on Create VPC Network … Here, I’m going to create developervpc in Singapore region…

👉 And then click on create button …
👉 In the same way, create another VPC in OREGON region

🔰 Step 2: Do VPC peering between both the VPCs …
🤔 What is VPC Peering ??
👉 In computer networking, peering is a voluntary interconnection of administratively separate Internet networks for the purpose of exchanging traffic between the users of each network. We mostly using Internet for transfer files / data … we can’t reliable on internet, coz we don’t know when it goes down … So google creates its own private / internal Network between the regions which they have deployed … By doing VPC peering , the VPCs internally connected to private network which is reliable …

👉 Go to VPC Network peering, Click on peering connection and do the things as shown below …
👉 peering connection for developervpc …

👉 peering connection for productionvpc …

👉 U can see the Active status of both peering networks …

🔰 Step 3: Now create Kubernetes Cluster in developervpc … Here the details for creation of Cluster …

👉 Click on create button which is in the bottom …

🔰Step 4: Installation of kubectl command on google cloud shell to check whether the cluster is created or not …

👉 Do above three steps in Google Cloud Shell … Here I’m sharing the link for those three steps → kubectl installation

🔰 Step 5: Connect to the Cluster using CLI .. Here I’m going to use Google Cloud Shell for the CLI … After creating cluster, click on connect you will see one pop-up window as shown below ..

👉 copy the command and then paste it into the Google Cloud Shell … This cmd will create certificates and keys for the cluster to login …
👉 After login into the cluster u can see the nodes in the cluster using this cmd “ kubectl get nodes ”

Ur cluster is ready to go …

🔰 Step 6: Now Launch one pod in the cluster using docker image called WordPress … Here is the cmd :

👉 After creating pod expose that pod using LoadBalancer to the public word … For exposing, here is the cmd :

👉 It will take some time to expose the pod … After that u can see one External_IP for that LoadBalancer service …

👉 Browse that IP , u will redirected to WordPress site …

🔰 Step 7: Create MySQL instance … Go to MySQL DB in Navigation bar … Do the things as shown below ..

👉 After creation of MySQL instance they give us one IP … Now check whether MySQL instance is created or not in Google Cloud Shell

👉 U don’t have connection for MySQL instance, coz of we didn’t have any firewall rule for that instance … Now we have to do some configuration on firewall ….

👉 Click on Edit Configuration. U will landed to this page and configure the things as shown below …

👉 Now again come to the google cloud shell and try to connect to mysql instance …

🔰 Step 8: Now create ur own database on MySQL instance ..

👉 Now give the details of the database which we have created before …

👉 If u see the above page in ur wordpress site, then the database which you have created is successfully connected to the wordpress … Then again login into the wordpress and create ur own post.
👉 And then publish the post then they provide the link to view it … Browse that link …

👏 Finally, Completed the task given by Vimal sir …
🙏 Thanks for reading !!!!

👋 …. Signing Off …. 👋

--

--