Deployment of WordPress Application in Google Cloud Platform along with Kubernetes Clusters and SQL Database
Sheetal Agarwal
AWS Community Builder | 4X GCP Certified | 3X AWS Certified | 1X Azure Certified | DevOps Engineer | Cloud Engineer | SRE | Kubernetes | Jenkins | Terraform | Ansible
?? 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 :
- 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.
2) We have to create two VPC's in different regions. For this Click on VPC Networks and then Create VPC Network-
>> VPC 1 -
>> VPC 2 -
Output -
3) Now we have to create firewall in both VPC's-
>> For VPC 1 -
>> For VPC 2 -
4) Now, we have to create two VM instance in each VPC. For this, first we have to enable the Compute Engine API.
>> Instance 1 -
>> Instance 2 -
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 -
>> For VPC2 -
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.
>> Now select kubernetes engine and then go to clusters and then click on create cluster-
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 -
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 -
>> Now, this time when we go to load balancing then we will find a load balancer -
8) Now to create Back end i.e. to store user data of WordPress application we use MySQL Database in GCP -
>> Here, we have to make SQL public so that anyone can connect -
9) Now, we have add user to SQL Server -
10) Now, we have create new database to SQL Server -
>> Here, we have to connect to SQL Server -
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 .
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 .
Software Engineer at Appzroot
4 年?? ??????????
★DevOps NMS Infrastructure
4 年Good job sheetal????