Deployment of WordPress Application in Google Cloud Platform along with Kubernetes Clusters and SQL Database

Deployment of WordPress Application in Google Cloud Platform along with Kubernetes Clusters and SQL Database

?? 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.

Pre-Configuration :

No alt text provided for this image
  • Create a account in Google Cloud Platform and Register for free tier.
  • In my case I am using QwikLabs . QwikLabs is the service by google which provide resources to do hands-on practicles.

Some basic terms -

  • GCP: Google Cloud Platform (GCP), offered by Google, is a suite of cloud computing services that runs on the same infrastructure that Google uses internally for its end-user products, such as Google Search, Gmail and You tube.
  • VPC: Virtual Private Cloud (VPC) provides networking functionality to Compute Engine virtual machine (VM) instances, Google Kubernetes Engine (GKE) clusters, and the App Engine flexible environment. It provides networking for your cloud-based resources and services that is global, scalable, and flexible.Virtual Private Cloud (VPC) provides networking functionality to Compute Engine virtual machine (VM) instances, Google Kubernetes Engine (GKE) clusters, and the App Engine flexible environment. It provides networking for your cloud-based resources and services that is global, scalable, and flexible.
  • VPC Peering: VPC Network Peering enables you to connect VPC networks so that workloads in different VPC networks can communicate internally.
  • Kubernetes: Kubernetes is open-source system for automating deployment, scaling and management of containerized application.
  • Load balancer: A load balancer distributes user traffic across multiple instances of your applications. By spreading the load, load balancing reduces the risk that your applications become overburdened, slow, or non-functional.

Now, Let's Start with the Practical part:-

1) For building of any kind of Infrastructure in GCP we need one project, So select a project under which we have to manage all the things.

No alt text provided for this image

2) We have to create two VPC's in different regions. For this Click on VPC Networks and then Create VPC Network-

No alt text provided for this image

>> VPC 1 -

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

>> VPC 2 -

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

Output -

No alt text provided for this image

3) Now we have to create firewall in both VPC's-

>> For VPC 1 -

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

>> For VPC 2 -

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

4) Now, we have to create two VM instance in each VPC. For this, first we have to enable the Compute Engine API.

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

>> Instance 1 -

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

>> Instance 2 -

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

5) For connecting these VPC we have to use VPC peering. For this we have to create VPC peer for both VPC's -

>> For VPC1 -

No alt text provided for this image

>> For VPC2 -

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

6) Now both VPC got connected by VPC peering .Then we have build a kubernetes master slave architecture. Now we have to create a kubernetes cluster inside the our VPC. For that first we have to enable the kubernetes engine API. Click on API & Services and then click on library . Then enable the kubernetes engine API.

No alt text provided for this image

>> Now select kubernetes engine and then go to clusters and then click on create cluster-

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

7) Now we have to login to GCP from Windows (Command Prompt). For login to GCP, first download google cloud sdk. Then login to GCP using the command "gcloud auth login" and then to communicate with kubernetes cluster running on Google Cloud we have to update the kubeconfig file such that kubectl command is configured to contact to Google Kubernetes Engine -

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

7) Now when we go to load balancing then we will find that there is no load balancer inside the load balancing. Now as soon as the pod exposed, we will see a load balancer created automatically -

No alt text provided for this image

>> Now, this time when we go to load balancing then we will find a load balancer -

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

 8)  Now to create Back end i.e. to store user data of WordPress application we use MySQL Database in GCP -

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

>> Here, we have to make SQL public so that anyone can connect -

No alt text provided for this image

9) Now, we have add user to SQL Server -

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

10) Now, we have create new database to SQL Server -

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

>> Here, we have to connect to SQL Server -

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

11) Final step is to connect WordPress application to back end i.e with MySQL Database . Using public IP of load balancer we can connect to WordPress application .

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

Here I have successfully completed the Project of Google Cloud Platform Workshop based on Integrating Kubernetes with Google Cloud Platform using Google Kubernetes Engine to deploy WordPress web application .

THANK YOU FOR READING ..!!!

Shalini Rana

Software Engineer at Appzroot

4 年

?? ??????????

回复
Kanishka Shakya

★DevOps NMS Infrastructure

4 年

Good job sheetal????

回复

要查看或添加评论,请登录

Sheetal Agarwal的更多文章

社区洞察

其他会员也浏览了