Lauch WordPress in Kubernetes Cluster with Intergration of SQL Database Using Google Kubernetes Engine(GKE) (GCLOUD)
What is the Google Kubernetes engine service?
Google Kubernetes Engine (GKE) provides a managed environment for deploying, managing, and scaling your containerized applications using Google infrastructure.The Kubernetes Engine environment consists of multiple machines (specifically Compute
Engine instances) grouped together to form a container cluster.
You Require some setup in your system to Complete the Setup: -
a) Gcloud Command-line tool setup:- A gcloud command-line interface is a tool that provides the primary CLI to Google Cloud Platform. You can use this tool to perform many common platform tasks either from the command-line or in scripts and other automation.
b) Kubectl Setup:- The kubectl command-line tool lets you control Kubernetes clusters To launch a WordPress on Kubernetes Engine with database as SQL we have to do some setup so there are the following steps:-
1. Create a project in which we are going to launch our Kubernetes cluster:
I created a project name ‘My first Project’
Then we are going to create a VPC network in the project
The Name of VPC network is ‘kubesubnet’ we created this VPC in asis-southeast-1
Then we go into the VPC network and create a ‘Firewall Rule’ to manage the traffic of our VPC
Here in Firewall Rule I am going to allow 80 port which is HTTP port in the internet
2. Create another project in which we launch our SQL database:
I create a project name ‘punnu-sql’ to launch my SQL Database
Then create the VPC Network in the 2nd project also.
I name this VPC network ‘sqlnewsubnet’ , I created this VPC in us-east1
Create the Firewall Rule same as we created in first project
3. VPC Peering
Both the projects are in different locations so to connect both the projects we have to do VPC Network Peering in both the VPC Networks
To do so follow the below steps-
Now the same VPC network peering we have to do in our second project
Here after doing VPC Network peering in both Projects VPCs we can check that the status comes ‘Active’
4. Launch Kubernetes Cluster In First Project
Now we are going to launch Kubernetes Cluster in our First Project
Follow the Below steps-
Select the Zone that we use in our VPC Network , network that we created earlier
Change and modify the nodes settings according to your requirements
5. Launch SQL Instance In 2nd Project
To launch SQL Database in 2nd project
Follow Below Steps-
Select the root password of your SQL Database
6. Start Kubernetes cluster And Deploy WordPress Site:
Follow the below steps-
Run the above command in your terminal if gcloud command is not installed in your PC then first download the gcloud software in your PC
Run the below command to see the no. of nodes on your Kubernetes Cluster
Now deploy your WordPress in the cluster using below command
By the below command you can check the status of your WordPress instance, That it is launched in one of the node.
Now we have to expose our WordPress to the internet to do so follow the below command
Here by using the command ‘kubectl get services’ you can find the public IP of your WordPress Site copy this IP address and paste it into the browser
After entering IP address this page will open
Now we integrate our SQL database to our WordPress site
But before that you need to first create a database in you SQL shown below
Here enter all the details necessary (you can find below details in the SQL information in gcloud)
Voila, you are good to go. your WordPress site is successfully setup
Fill the necessary details
Voila , here comes your WordPress dashboard
Comments
Post a Comment