Deployment of WordPress using Google Cloud Platform
Tags: googlecloud, wordpress, kubernetes, cloudcomputing
Published: 2021-03-19 17:19:07

Hello Everyone, I hope You are all doing well.

In This Great story, I want to share the great use case I learned In the Workshop of Google Cloud Platform under the guidance of Mr. Vimal Daga.

→Google Cloud Platform: Google Cloud Platform is essentially a public cloud-based machine whose services are delivered to customers on an as-you-go basis, by way of service components. Google Cloud Platform (GCP) is a collection of Google’s computing resources, made available via services to the general public as a public cloud offering.

Follow the Steps:

Task Overview:

>Creating Different 2 VPCs in vivid regions:

Go to GCP Console and then click on VPC Network and You will land on this below page. Click on Create VPC Network and Create two VPCs in different regions by clicking on create button. After the creation, we have to perform VPC Peering.

VPC Peering: 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.
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qlkj0v2mfshgiwhx2hie.png)
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0v7ld5f1zrz78h0uz8av.png)
→Now create Kubernetes Cluster in the developer’s VPC… Here the details for the creation of Cluster. Also, Go for install of Kubernetes Installation after this.

command: curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/amd64/kubectl

![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b0jk0p72tqhoiss32nqk.png)
 
Atlast click the create button to create cluster .

→Google cloud shell can be used to do command line operations.

→Connect to the Cluster using CLI Here I’m going to use Google Cloud Shell for the Command line .After creating cluster, click on connect you will see one pop-up window ,There will a command to copy and that you have run in cloud shell. Now Launch one pod in the cluster using docker image called WordPress. — Command:kubectl create deployment myweb — image =vimal13/apache-webserver-php. Here You can also use official image of wordpress. After that we must expose the pod using loadbalancer. Command for this: kubectl expose deployment myweb — type=LoadBalancer — port =80

After this browse to the ip got by running command kubectl get services,
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pr9e39q7r1fbd0tg90hr.png)
 
→Now we have to Create a SQL server in the production project and create a database.For this we have to a MySQL instance and after this we have to check whether it is created or not.

Check using the ip given by them and run command mysql -h “ip” -u “username” -p and then enter password.
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mlrkdja4nlpxdnkjdb6z.png)
→If we are not able to connect then we have to check the firewall setting by clicking on “edit configuration”
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/th8v2xr3yek17fzp2mm5.png)
→And Now try to connect to the instance instance. We should get this
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1lqm85sujjwo8k6ezku3.png)
→Now we have to create database on SQL instance.
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6aqk6vs06rrh64hzvg7r.png)
→Fill the following Information
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wvavcd8qlm6yn2hajjch.png)
We can create our own post and publish it.
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ueaoz69l2jtna5fwwjr.png)
Atlast ,The task Given by Vimal daga sir is completed

Thanks for Reading😊😊