Deployment of WordPress Web Application by Integrating Google Cloud Platform with Kubernetes

Deployment of WordPress Web Application by Integrating Google Cloud Platform with Kubernetes

𝗛𝗲𝗹𝗹𝗼 Friends !! Welcome you all to my article on Deployment of WordPress Web Application by Integrating Google Cloud Platform with Kubernetes. An overview of Kubernetes and GCP Service With WordPress will also be present. Finally How can we utilize Terraform with GCP and Kubernetes for webserver deployment? We are also utilizing or building WordPress to create this application, as well as Deployment of Web Application on Kubernetes. Deployment Deployment of WordPress Web Application by Integrating Google Cloud Platform with Kubernetes.

Table of Contents

PROJECT DESCRIPTION :

  1. Create multi projects with dev and prod
  2. Make VPC network for dev project
  3. Create VPC network for prod project
  4. Connect both the VPC network with VPC peering
  5. Create a Kubernetes Cluster in dev project and launch a wordpress/Joomla application with the Load balancer
  6. Create a SQL server in prod project and create a database
  7. Connect the SQL database with the application launched in the K8s cluster

PROJECT COMPLETION :

This project is based on deployment of WordPress application using Integration of Google Cloud Platform and Kubernetes by Google Kubernetes Engine .

☁ Google Cloud Platform ☁

Google Cloud Platform (GCP) is a set of cloud computing services supplied by Google that run on the same infrastructure as Google’s internal products, such as Google Search, Gmail, and YouTube.

  1. Any type of infrastructure built on Google Cloud Platform must be done as part of a project. So, for both development and production platforms, I built a single project called cloudproject.
Deployment of WordPress Web Application by Integrating Google Cloud Platform with Kubernetes
2)As part of this project, we will need to set up two VPCs (Virtual Private Clouds)

, one for WordPress deployment and the other for MySQL Database Instance. I named these VPCs VPC1 in the US-central1 region and VPC2 in the US-east1 region, respectively. We must construct a subnet for networking activities of the instances within VPC. Another thing we need to do is add a firewall rule that lets all traffic into the VPC as an Ingress Rule.

–>Creating firewall rule for Ingress traffic :

Deployment of WordPress Web Application by Integrating Google Cloud Platform with Kubernetes

–> Creating VPC network for development and production platforms :

Deployment of WordPress Web Application by Integrating Google Cloud Platform with Kubernetes
3)We must utilise GCP’s VPC Peering service to join these VPCs.

We must build VPC peers for both VPC1 and VPC2 as peer1 and peer2 in order to peer the VPCs.

Deployment of WordPress Web Application by Integrating Google Cloud Platform with Kubernetes
Deployment of WordPress Web Application by Integrating Google Cloud Platform with Kubernetes
4) Now, VPC peering has connected both VPCs.

Then, for the deployment of the WordPress application, we also built a Kubernetes master slave architecture, or cluster. Because Google Cloud Platform delivers Kubernetes As A Service via Google Kubernetes Engine, we don’t need to construct our own cluster or configure master and all that for kubernetes. To also use the Google Kubernetes Engine service, we only need to provide them with the Node Pool specs. Then they assume full responsibility for the creation of a Kubernetes cluster as well as cluster administration.

–> Creating Kubernetes Cluster for development platform in VPC1 :

Deployment of WordPress Web Application by Integrating Google Cloud Platform with Kubernetes
Deployment of WordPress Web Application by Integrating Google Cloud Platform with Kubernetes

–>Specifying node information for kubernetes cluster :

Deployment of WordPress Web Application by Integrating Google Cloud Platform with Kubernetes
Kubernetes

—>Cluster Created Successfully

WordPress
5)We must contact Google Kubernetes Engine in order to install the WordPress application in a kubernetes cluster.

To connect with the Kubernetes master, which sends additional tasks to its slave nodes, we need to configure the kubectl application in our system.

In this situation, we’re utilising Google Cloud Platform, which offers Kubernetes As A Service (KaaS) via Google Kubernetes Engine, and we’ll need to contact GCP from our system to get started.

To do so, we’ll need to install the Google Cloud SDK Shell Program on our PC, which will give us with all of the GCP commands we’ll need to access Google Cloud.

–> Log in to Google Cloud Platform using Google Cloud SDK :

gcloud auth login
 Kubernetes

–> Use of Google Cloud Native Commands :

 Google Cloud Platform with Kubernetes

To interface with a Google Cloud kubernetes cluster, we must alter the kubeconfig file so that the kubectl programme can communicate with Google Kubernetes Engine.

 Google Cloud Platform with Kubernetes

To see the node information use command :

kubectl get nodes 

 Google Cloud Platform

6)To use Kubernetes to deploy the WordPress application, we must first establish a deployment in Kubernetes that uses the WordPress image to launch the pods.

kubectl create deployment (name) --image=(image_name)
Deployment of WordPress Web Application by Integrating Google Cloud Platform with Kubernetes

We must launch the WordPress application on the internet after generating the kubernetes deployment because the kubernetes environment is isolated by default. In order to access the application, we must expose the deployment on port 80. We’ll also need a load balancer for the deployment, which will balance all of the traffic coming in from the outside world.

Load Balancer: Because we’re utilising Google Kubernetes Engine, we’ll be using Google Cloud Platform’s load balancer by default. However, because we must give the load balancer to the kubernetes deployment, it is an external load balancer for kubernetes.

kubectl expose deployment (deployment_name) --type=LoadBalancer --port=80
 Kubernetes

In kubernetes the load balancer is known as Service .We can

In kubernetes the load balancer is known as Service .We can see all the services used by the deployment using command –>

see all the services used by the deployment using command –>

kubectl get services
Google Cloud Platform

We can also see through GUI one load balancer got created –>

Deployment of WordPress Web

To see everything is properly created or not in kubernetes use command –>

kubectl get all
Deployment of WordPress Web Application by Integrating Google Cloud Platform with Kubernetes
7)Our WordPress application’s front end is now complete too

. We also used MySQL database to develop the back end methods to store the user data of the WordPress application. For us, the most important thing is to maintain the database, hence we utilise Google Cloud’s Database As A Service as MySQL.

As a result, we must use Google Cloud’s SQL service to launch these MySQL Database instances in a production environment, i.e. in VPC2.

 Kubernetes

–> Adding authorized network to public ip of MySQL Instance :         

Google Cloud Platform with Kubernetes

–> Log in to MySQL Instance to see available databases :

mysql -h (public_ip) -u (user_name) -p
Deployment of WordPress
Deployment of WordPress Web Application by Integrating Google Cloud Platform with Kubernetes

–>Creating new database :

Kubernetes

8) The last step is to link the WordPress programme to the database, which is a MySQL database. We may also connect to the WordPress application using the load balancer’s public IP.

Deployment of WordPress Web

To connect a MySQL database to a WordPress application, we also must first add the database user’s username and password.

Deployment of WordPress Web Application

After successfully connecting the database and login to WordPress we can also run the installation of the WordPress application .

Deployment of WordPress Web Application by Integrating Google Cloud Platform with Kubernetes
Google Cloud Platform with Kubernetes

Deployment of WordPress Web Application by Integrating Google Cloud Platform with Kubernetes

Finally, I completed the Google Cloud Platform Workshop project Integrating Kubernetes with Google Cloud Platform using Google Kubernetes Engine to deploy WordPress web application in this manner.

Chirag Goyal

Spread the love

Leave a Reply