WORDPRESS ON THE TOP OF K8S CLUSTER USING GCP SERVICES.
So, In this article, we will be launching a WORDPRESS APPLICATION on the top of KUBERNETES CLUSTER using GKE service of GCP and will further integrate it with the SQL database.
What is GKE?🤔
Google Kubernetes Engine (GKE) provides a managed environment for deploying, managing, and scaling your containerized applications using Google infrastructure. The GKE environment consists of multiple machines (specifically, Compute Engine instances) grouped together to form a cluster.
What is WordPress?🤔
So, we will be the following steps throughout the article.
🔴We will create multiple projects.
🔴Then, we will create a VPC network for both the projects.
🔴Now, we will create a link between both the VPC networks using VPC Peering.
🔴And,we will be creating a Kubernetes Cluster in the developer project and launch WORDPRESS with the Load balancer.
🔴For the Database, we will create a SQL server in the production project.
🔴Atlast, we will connect the SQL database to the web application launched in the Kubernetes cluster.
Just go to your GCP Console and click on projects and then click on Create New Project.
Here we will be creating TWO PROJECTS named as
What is VPC?
A virtual private cloud (VPC) is the legitimate division of a specialist co-op’s open cloud multi-inhabitant design to help private distributed computing. This model empowers a venture to accomplish the advantages of private cloud — for example, progressively granular authority over virtual systems and a separated domain for delicate outstanding tasks at hand — while as yet exploiting open cloud assets.
The terms private cloud and virtual private cloud are now and then utilized mistakenly as equivalent words. There is a particular distinction — in a customary, on-premises private cloud model, an undertaking’s inside IT division goes about as a specialist organization and the individual specialty units go about as occupants. With a VPC, an open cloud supplier goes about as the specialist organization and the cloud’s supporters are the inhabitants.
Subnets are the following bit of the VPC. Why utilize distinctive subnets in your VPC and not just leave everything in one major glad (family) organize? There are various purposes behind this.
Create a VPC network and VM instances
Create an auto mode VPC network with Firewall rules
Replicate the default network by creating an auto mode network.
- In the Console, navigate to Navigation menu< VPC network < VPC networks, and then click Create VPC network.
- Set the Name to developvpc for develop-1808 and productvpc for product-1808.
- For Firewall rules, check all available rules. (These are the same standard firewall rules that the default network had) and the IP should be 0.0.0.0/0 .
- Now create Subnet creation mode.
- Click Create, then wait for mynetwork to be created. (Notice that a subnet was created for each region)
- Record the IP address range for the subnets.
Same will be followed for Product-1808 and after creating VPC for both the The only difference in both the projects is both the VPC are launched in different regions.
Now, we will create a link between both VPC by using VPC PEERING.
Now we will launch the kubernates cluster in develop-1808 project.
Now you have to download the gcloud SDK. The gcloud command-line interface is the primary CLI tool to create and manage Google Cloud resources. You can use this tool to perform many common platform tasks either from the command line or in scripts and other automations.
Click on the connect and copy the command and paste it in command line.
Kubernetes cluster is successfully deployed and now for launching wordpress we will use the command
kubectl create deployment abhi --image=wordpress
Now, we will be attaching one LOADBALANCER, also we will expose our APPLICATION.
kubectl expose deployment abhi --type=LoadBalancer --port=80
kubectl get all
This command will show all the resources and services that are launched.
Here Just copy the IP of LoadBalancer and paste it in browser.
Everything is good we have launched WordPress Application on the top of Cluster.
Now we will connect it with SQL DataBase.
👉Step-5 & Step-6
For creating SQL DB just fill out the name, password, region where we want to deploy our SQL DB.
For this we will be making SQL DataBase in GCP.
Now, we have to specify the DataBase user name, password, DataBase Hostname to connect it with our DataBase.
Just fill all the details and in the field of DATABASE HOSTNAME copy your public IP of SQL DataBase.
DONE!! EVERYTHING IS COMPLETED.
Provide the required information to run this successfully.