DEPLOYING WORDPRESS ON GOOGLE CLOUD PLATFORM and MANAGING IT USING GKE
HELLO GUYS, THIS IS ME ONCE AGAIN I WANT TO SHARE ONE MORE GREAT INTEGRATED SETUP OF WORDPRESS (which is a web hosting site) THAT I HAVE RECENTLY CREATED ON GOOGLE CLOUD PLATEFORM .
BEFORE START LET GET SOME BRIEF INFO ABOUT SOME PREREQUSITES AND STEPS FOR CREATING THIS WEBHOSTING SETUP-->
SERVICES OF GCP THAT I WILL USE FOR THIS SETUP::::::::
1.) PROJECT IN GCP:
A project organizes all your Google Cloud resources. A project consists of a set of users; a set of APIs; and billing, authentication, and monitoring settings for those APIs. So, for example, all of your Cloud Storage buckets and objects, along with user permissions for accessing them, reside in a project.
2.)GOOGLE KUBERNETES ENGINE:
you guys should have high level idea about Google Kuberenetes Engine(GKE) i mean what is its use case. let me give you some brief about it:
mainly this is a devops tool. gke is an enterprise grade container management service created by google, which also created kubernetes itself gke makes it easy to deploy k8s(kubernetres) cluster on a secure and trusted plateform. gke takes care of security, networking, the underlaying infrastructure and performance.
3.)VPC(VIRTUAL PRIVATE CLOUD):
A virtual private cloud is an on-demand configurable pool of shared computing resources allocated within a public cloud environment, providing a certain level of isolation between the different organizations using the resources.
4.)GOOGLE COMPUTE ENGINE:
Google Compute Engine is the Infrastructure as a Service component of Google Cloud Platform which is built on the global infrastructure that runs Google's search engine, Gmail, YouTube and other services. Google Compute Engine enables users to launch virtual machines on demand.
5.)WORDPRESS IMAGE:
I don't need to tell you guys much about wordpress as you all know it is a website hosting plateform where you can write blogs and customize it according to the demand by adding some look and feel. But i will tell you guys from where i got this wordpress image actually i used wordpress official docker image and deployed its container on the top of kubernetes engine.
- DOCKER:
Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels.
YOU GUYS SHOULD HAVE HIGH LEVEL IDEA ABOUT ABOVE TECHNOLOGIES I AM ASSUMING YOU ALL HAVE DONE SOME HANDS ON PRACTICALS ON ABOVE TECHS OR HAVE HIGH LEVEL IDEA ABOUT THEM AND YOU HAVE GCP ACCOUNT AS WELL.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
==NOW LETS START TO BUILD THIS INFRASTRUCTURE ::
STEP1. first of all login to GCP console and click on navigation menu.
STEP2: Now we have two create TWO VPCs in TWO different PROJECTS
- FIRST VPC:
1.)IN project <My First Project>
-name: dev-vpc
- add new subnet with name: devlab
-configuring firewall
-now lets create the VPC
- SECOND VPC:
1.)IN project <RTprojectONE>
-name: prod-vpc
- add new subnet with name: prod-lab
further configurations in this VPC
-Creating firewall
--------------------------------------------------------------------------------------------------------------- VPC CREATION COMPLETE -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
STEP2:A VPC peering means connecting two VPCs in same network that enables you to route traffic between them using private IPv4 addresses or IPv6 addresses. Instances in either VPC can communicate with each other as if they are within the same network. I have launched my prod-vpc in US-east1(Carolina) region and dev-vpc in asia-southeast1(Singapore) region. So toom nake connectivity i have to do this peering. So, we have to do this peering from both the side
1.)My first Project: creating VPC peering
-after clicking on create we got this
2.) RTprojectONE:
-step one is same as that of previous VPC peering creation
hence we got,
--------------------------------------------------------------------------------------------------------------------------------------------------VPC PEERING COMPLETE-----------------------------------------------------------------------------------------------------------------------------------------------------
STEP3: NOW WE HAVE TO CREATE K8S is kubernetes cluster using GKE(Google Kubernetes_Engine)
1.) Select GKE in GCP navigation menu, and select cluster in it.
2.)Now enter required cluster basics specifications
-give specifications in default-pool
-now, providing Nodes specifications
-providing atlast networking settings, and then click on create flatbutton
-CLUSTER CREATED SUCCESSFULLY
-HERE IS ITS DETAILED INFO
-AS you can see three nodes launched in the Compute instances as VMinstances
-NOW LETS CONNECT TO THE K8S CLUSTER
IN below screenshot behind the thick red line you will get the link with credentials , you have to copy this and past in the command prompt after installing google SDK in your system. I have hide the command for security reasons.
-Here we have to past the command we get above,
-now we have to create deployment for the wordpress so that we can setup our webhosting
-now we have to create LoadBalancer for our webserver loadbalancer will distribute the load of client in all the pods when client hit to the server increase
our webserver launch lets check our website
-After selecting we have to add database server to provide data service to wordpress
--------------------------------------------------------------------------------------------------------------------------------------NOW WE HAVE TO CREATE DATABASE SERVER---------------------------------------------------------------------------------------------------------------------------------
STEP4: We will create database in our prod-vpc which is present in our project named RTprojectONE
-select SQL in navigation menue in GCP;
- CLICK ON CREATE AS SHOWN ABOVE
- Now select the type of sql database ,
-configure this database as shown in below,
-MSQL DATABASE CREATED IN OTHER VPC
-NOW LETS CREATE USER AND IT TO DATABASE
-----------------------------------------------------------------------------------------------------------------------------NOW LETS CONNECT DATABASE TO THE WORDPRESS--------------------------------------------------------------------------------------------------------------------------------
- PROVIDING CREDENTIALS OF DATABASE TO THE WORDPRESS
AFTER PROVIDING CREDENTIALS you are ready for installion and login
-ADD LOGIN AND PASSWORD
-------------------------------SETUP COMPLETE-------------------------------------------------------------------------------------------------------------------------------------------------------------------
SERVER RUNNING SUCCESSFULLY NOW CUSTOMIZE YOUR WORDPRESS IN WHATEVER THE WAY YOU WANT AND HOST YOUR OWN SITE
-------------------------------------------------------------------
!!!!!! I HOPE YOU LIKED MY WORK THANK YOU !!!!!!