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

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.

👉Step-1

Here we will be creating TWO PROJECTS named as

🔺Develop-1801.
🔺Product-1802.

👉Step-2

What is VPC?

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

Create a VPC network and VM instances

Replicate the default network by creating an auto mode network.

  1. In the Console, navigate to Navigation menu< VPC network < VPC networks, and then click Create VPC network.
  2. Set the Name to developvpc for develop-1808 and productvpc for product-1808.
  3. 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 .
  4. Now create Subnet creation mode.
  5. Click Create, then wait for mynetwork to be created. (Notice that a subnet was created for each region)
  6. Record the IP address range for the subnets.

👉Step-3

Now, we will create a link between both VPC by using VPC PEERING.

👉Step-4

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.

HURRAY!!

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

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store