How to Deploy WrodPress on Google Cloud Platform

Parag Rahate
4 min readNov 12, 2020

In this article I will show you How to deploy your wordPress site on GCP. In this I will use some of the GCP services like Google Kubernetes Engine to deploy our WordPress site and SQL service to deploy our database also use services like VPC and Load Balancer.

Project Description:

1. Create multiple projects namely developer and production.

2. Create VPC network for both the projects.

3. Create a link between both the VPC networks using VPC Peering.

4. Create a Kubernetes Cluster in developer project and launch any web application with the Load balancer.

5. Create a SQL server in the production project and create a database.

6. Connect the SQL database to the web application launched in the Kubernetes cluster.

Before going to implement project it requires some perquisites.

  1. Install Google Cloud SDK: Google Cloud SDK is a set of tools that you can use to manage resources and applications hosted on Google Cloud.
  2. Install Kubectl Interface: It allows you to perform every possible Kubernetes operation. kubectl is a client for the Kubernetes API.

Step 1: Create two VPC’s namely developer and production. You have to specify subnet for both of them with IP’s addresses range and also select region for both.

Step 2: Create a link between both the VPC networks using VPC Peering. You have to create peering of both production and development network to each other.

Step 3: Create Kubernetes Cluster.

  • Give name to the cluster and select region for cluster
  • In Default pool, select no. of nodes per zone 1.
  • In networking tab select developvpc as network along with its subnet and then press create button. This will create cluster.
  • Click on connect button to connect cluster with CLI. This will provide command which is used to connect our cluster with SDK. Paste this command in your command prompt.

Step 4: Use the commands as shown in image to deploy wordPress on cluster.

  • Load Balancer is created for the cluster.

Step 5: Browse the External IP which we found in step 4.You will seen that wordPress installation page is open.

Step 6: Create MySQL instance for production vpc.

  • Edit Instance name, set password and select region and zone.
  • Add new network allowing all IPs.

Step 6: Create User and Database for the wordPress site.

  • In overview you will see public IP which is used to connect WordPress to our database

Step 7: Connect the database with application launched in Kubernetes cluster using the correct credentials.

Finally you are now able to access the wordpress site which is hosted on GCP.

Thank you.

--

--