Integration of WordPress web Application over kubernetes Engine with SQL Storage of GCP
Hello Everyone!!!
In this article, I am going to show the approach for completing ππ€π€ππ‘π πΎπ‘π€πͺπ ππ‘ππ©ππ€π§π’ project task.
π° 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.
π― I have completed this project using Google Qwiklab and so I use single project for both development and production .
π― Project Overview:
In this project, i have completed an integration of WordPress Web Application launched using a fully managed tool i.e., Kubernetes Engine with SQL Storage in Google Cloud Platform.
What is 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.
What is VPC?
A virtual private cloud (VPC) is a secure, isolated private cloud hosted within a public cloud.
So, lets start creating the integration now. We will complete it step by step:
Firstly, if we wanted to work on infrastructure of Google Cloud Platform then we need to create a project. I am going to use a single project here.
Step 1: Create two VPCs one for development and one for production environment and create separate subnet for both.
After this we will add some rules to the firewall for both the VPCs.
Step 2: Creating a peering connection between both the VPCs.
Similarly, we need to create a peering connection from prod to dev VPC network. Hence, we can get the Active peering connection between the VPC networks.
Step 3: Creating a Kubernetes cluster using Kubernetes Engine in Google Cloud Platform.
Now, we will set the no. of nodes (per zone).
Also, in the Network select the VPC to dev and Zone devlab01(created above).
Step 4: Connecting to the Kubernetes Cluster.
For connecting to the cluster click to the connect button.
Also, check all the nodes of this cluster.
Now, copy the command from here and run it on the terminal or command prompt(since i have gcloud-sdk already installed).
Before running the command, need to have the authenticate login.
After this check that kubeconfig is updated or not ? , using βkubectl config viewβ command.
Since the config file is successfully updated. So, next we will create deployment for WordPress using the yml file.
Step 5: Create Deployment using yml file, i.e.,
Now, apply this code for WordPress deployment.
Access all the resources of this cluster, using βkubectl get allβ command.
Step 6: Creating an SQL storage instance in Google Cloud Platform.
Here we have filled the instance ID and Password to create the SQL instance.
After some minutes, we can see that the instance has been successfully created.
Step 7: Connecting to the SQL instance through gcloud shell.
After entering the password, we can access the mysql prompt here.
Step 8: Creating separate user, database for connection from WordPress.
- Check for the users in this instance.
2. Create a new user, by providing username and password.
3. Check for databases in this instance.
4. Create a new database for WordPress data.
5. Set connectivity by adding a new user.
Step 9: Connecting to the WordPress instance that we have launched in Kubernetes cluster.
After this , we need to enter the database name, username, password and IP address of the SQL instance that we have created. As soon as we submit, we get connected to the MySQL storage instance.
After this, provide the information for successful installation of WordPress.
Hit βInstall WordPressβ. We get the Login Page.
Now, we can set any theme as per our choice and can write some interesting blogs, stories also everything will be secured as we have attached an SQL storage with this.
Lets write a story!!!
Hence this blog can be accessed by the given βView Postβ button on the right pane.
Finally, with these steps 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 and connecting SQL Storage to it for secured data.
Thank You!!!
π« Keep Sharing, Keep Learning π«