Deploy Wordpress Site on Top of Google Cloud

Aim:- Our main is to deploy site on top of Google cloud. In my case my frontend would be my wordpress site which is running on different location in my case i took asia-southeast-1 as a region and my backend which is my database is running on different region in my case us-east1 and i want that this database will be managed by google it means i want some service that is fully managed by service so i used SQL database provided by google. Now to launch wordpress site we want OS, we can launch OS manually but if my OS goes shut down we have to run another OS manually we don’t want this so i used GKE(Google kubernetes Engine). Kubernetes will launch pod for me and if one of my pod goes down it will starts automatically we don’t have to start manually again and again.

So let’s jump directly to our practical part.

First we create two VPC one is devvpc and one is prodvpc and attach some firewall rules

Now after creating two vpc, we set VPC peering between two VPC. This peering will provides me fast,secure and reliable connection. For example if we want to send some confidential data between two VPC we can reliable on public network so google provides this facility to transfer our data in fast and secure manner for this we have to enable VPC peering

Now i create my backend which is my database.

Now we configure gcloud command in our system this is the command that we can communicate our google cloud without going to cloud using cli.

https://cloud.google.com/sdk/docs/downloads-versioned-archives.

After install this software in windows it asks to authorize with gcloud after authorizing with gcloud i can run any cloud on gcloud with my cli

Now i am configuring kubernetes.

Here i’m testing my connectivity with my mysql database.

Now, I am launching our wordpress pod using kubectl command

kubectl create deploy <deploy_name> — image=wordpress

Then i expose my site so that outside client can connect

kubectl expose deploy/<deploy_name> — type=LoadBalancer — port=80

Here is my wordpress site which is working perfectly.

We are done with our task.

#keepcoding #keep sharing #googlecloud #kubernetes

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
mayank agrawal

I am devops enthusiast always trying to learn new technologies and try to implement in real world to solve real use cases. Creative integrator