GOOGLE CLOUD PLATFORM
GCP TASK
1. Create TWO projects.
2. Create a VPC network for both the projects
3. Create a link between both the VPC networks using VPC Peering
4. Create a Kubernetes Cluster in one project and launch any web application with the load balancer.
5. Create a SQL server in the second project and create a database.
6. Connect the SQL database to the web application launched in the Kubernetes cluster.
GCP - Google Cloud Platform is a public cloud which provides different-different resources according to user need. When we want to start a business we don’t know that it will be successful or not so we can’t invest a lot on land, electricity, hardware, etc so much so we can use cloud here it provides isolation, security, virtual space where we can work and a lot more.
GCP has a great feature of projects which are isolated and secure. If there is a failure in one project then it won’t affect the others.GCP works on API means for using any services first we need to enable the API.
PROJECTS -
I am creating two projects here who are totally isolated and will be connected later on by VPC Peering.
I am creating two projects named “mypro” and “devproject432” .You can name according to your requirement.
In the below images you can see that it is created.
VPC- Virtual Private Network
It can be related to a land where you can do your own setup without the interference of others.VPC provides virtualization , isolation,security,etc.
In the VPC, Subnets are created which can be considered as a lab where we build things. So in the subnet, we will be launching instances.
Launching VPC in “mypro” project-
Launching VPC in “devproject432” project-
“mypro” project VPC is created.
“devproject432” project is created.
FIREWALL-
A firewall is a kind of wall which allows only those ports which are allowed by admin. We can set Ingress/egress in it.
Firewall for VPC1
Firewall for VPC2
VPC1 firewall is created.
VPC2 firewall is created.
VPC PEERING -
It is a very different feature of GCP which allows two instances or two services present in different projects can be connected.
So here “mypro” and “devproject432” will be connected by VPC peering.
VPC peering in “mypro”
VPC peering in “devproject432”.
VPC Peering formed for the “mypro” project.
VPC Peering formed for “devproject432”.
KUBERNETES CLUSTER-
K8S is a program that manages, monitors, does load balancing, etc in the cluster.
Here in the cluster WORDPRESS will be going to launch.
Take this image from Docker Hub.
Finally, the cluster is created.
Now connect this cluster with kubectl which is present on windows base O.S.
So run this command in the command prompt.
Open the windows command prompt and then run the above command.
To check how many pods are running use the command “kubectl get pods”.
To check how many nodes are running use the command “kubectl get nodes”.
To deploy the WordPress image on the node we use the command “kubectl create deployment MyWeb --image=wordpress‘
To expose this deployed image in the public we use the command “kubectl expose deployment MyWeb --type=LoadBalancer --port=80”.
WordPress is running properly.
MYSQL-
MySQL is a database used to store the relational database. So here the data entered in WordPress will be stored in MySQL so we need to connect it with WordPress.
The MySQL instance is ready.
Create the database in MySQL so that WordPress will be able to store data here.
CONNECT WORDPRESS WITH THE MYSQL SERVER.
FINALLY, WORDPRESS IS ABLE TO POST.
THANK YOU FOR READING.
Comments
Post a Comment