WordPress site hosting on Google Cloud Platform

WordPress site hosting on Google Cloud Platform

In this project, we are going to deploy WordPress site on Google Cloud Platforms services. We will use Google Kubernetes Engine to deploy our WordPress site and SQL service to deploy our database. In this project we also cover some basic services like VPC and Load Balancer.

Project Description:

1. Create two VPC's namely developer and production

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

3. Create a Kubernetes Cluster in developer vpc and launch any web application with the Load Balancer

4. Create a SQL server in the production vpc and create a database

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

As I am using QwikLabs, I am going to create both the production and developer VPC in same Project.

Prerequisite: Before going to the project implementation, let's set up all the prerequisite.

  1. Google Cloud SDK: Install this tool which help you in managing your resources and application.
  2. kubectl Command Line: This command line tool will help you in managing your kubernetes cluster.

Step1: Create two VPC named under production and development by going to the VPC network service. You have to specify subnet for both of them with IP's addresses range.

No alt text provided for this image
No alt text provided for this image

Step2: Create VPC network for the VPC's by using VPC Peering Network service which will connect both the VPC's. When you create first connection from 'dev-vpc' to 'prod-vpc' then you will be see it is inactive. It will acitve after you establish connection between 'prod-vpc' to 'dev-vpc'.

No alt text provided for this image

Step3: Create kubernetes cluster.

  • Give name, choose regional in location type and select respective region.
No alt text provided for this image
  • In Node pool details, select no. of nodes per zone 1.
No alt text provided for this image
  • In a Networking tab choose dev-vpc that we created earlier with respective subnet. Then click on create.
No alt text provided for this image
  • This will create cluster. Click on connect to connect to our cluster from CLI.
No alt text provided for this image
  • A link will be provided for command-line access to connect to the cluster.
No alt text provided for this image
  • Run this command on CMD and we can see our cluster and nodes.
No alt text provided for this image
  • Create WordPress deployment and expose it to the LoadBalancer service.
No alt text provided for this image
  • We can see now our service is ready and expernal-IP generated
No alt text provided for this image
  • Load Balancer service is create in GCP cloud we can see from WebUI
No alt text provided for this image
  • After browsing our External-IP we can WordPress site.
No alt text provided for this image

Step4: Create a SQL server in the production vpc and create a database

  • Create MySQL Data base from GCP's SQL service.
No alt text provided for this image
  • Provide Instance ID and Password.
No alt text provided for this image
  • Edit the Instance and add new network allowing all IP's
No alt text provided for this image
  • Add user to the Database
No alt text provided for this image
  • Create a database 'testdb' and give password. We will connect our WordPress application to this database.
No alt text provided for this image
  • In overview we can see public IP that will be used while connecting application to the database instance.
No alt text provided for this image

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

No alt text provided for this image

After setting up we are now able to access our site which is hosted on Google Kubernetes Engine and database in GCP SQL server.

No alt text provided for this image

Thank You for Reading !!

To view or add a comment, sign in

More articles by Mohini Rahate

Others also viewed

Explore content categories