Google Cloud Platform Task
What is Cloud Computing?
Cloud computing is the delivery of on-demand computing services — from applications to storage and processing power — typically over the internet and on a pay-as-you-go basis. Rather than owning their own computing infrastructure or data centers, companies can rent access to anything from applications to storage from a cloud service provider.
One benefit of using cloud computing services is that firms can avoid the upfront cost and complexity of owning and maintaining their own IT infrastructure, and instead simply pay for what they use, when they use it.
In turn, providers of cloud computing services can benefit from significant economies of scale by delivering the same services to a wide range of customers.
There are many Public Cloud Providers: — Azure By Microsoft, Amazon Web Services, Google Cloud Platform, etc.
What is GCP?
Google Cloud Platform is a suite of public cloud computing services offered by Google. The platform includes a range of hosted services for compute, storage and application development that run on Google hardware.
Google Cloud Platform services can be accessed by software developers, cloud administrators and other enterprise IT professionals over the public internet or through a dedicated network connection.
There are many services provided by GCP and has many Advantages.
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
Explanation and Steps
1. Creating Projects, vpc’s and Peering them
Step -1: Creating two projects namely Cdeveloper and Cproduction.
Step-2: Creating vpc network named devvpc and sunet named devsubnet in Cdeveloper project.
Step-3: Creating vpc network named provpc and subnet named prosubnet in Cproduction project.
Step-4: Creating instance in Cprodcution and changing its vpc to provpc and subnet to prosubnet.
Step-5: Creating instance in Cdeveloper and changing its vpc to devvpc and subnet to devsubnet.
Step-6: Now going to VPC network peering in Cproduction project and creating peering connection names provpcpeering selecting provpc network in your vpc network list. Now entering project ID and vpc network name of the project of which we have to make peering to.
Step-7: Repeating same steps as above for Cdeveloper project.
Step-8: Now vpc peering is successfully established. But there is a problem that because of firewall the two vpc on the private network will not be able to connect with each other. So to establish connection between them we have to attach some firewall rules.
Step-9: Yes, now everything is fully set up. Now we can able to ping instances of two different vpc’s through there private network ,i.e, through private ip as vpc peering is successfully established.
As in the image above we can see that the instance in Cdeveloper project has private ip 10.0.1.2 so we are able to ping to this private ip through the instance in Cproduction project which is in different vpc.
By this we can conclude that vpc peering is successfully established!!!!!.
Also we can check that we are also able to ping it with our public ip.
2. Creating Kubernetes Cluster
Step-1: Name given to cluster is mycluster and location type given is regional with default node locations. This cluster is created in Cdeveloper project.
Step-2: The name of the node pool is mypool and number of nodes per zone is 1 ,i.e, total 3 nodes.
We can verify that three nodes are launched with a kubernetes cluster named mycluster.
Step-3: Now on windows/mac/linux which ever the OS user is using, install kubectl.exe to access the kubernetes cluster. In our case it is clearly showing us three cluster from cli too.
3. Creating SQl server
Step-1: Change the project to Cproduction and create sql server.
Step-2: Creating mysql instance named mydatabase with some root password and specific region and zone.
After this mysql instance will be created within few minutes.
Step-3: Now go to edit instance and change its ip as public ip and attach network details to allow connection with the database.
As we can see in the following image that sql is successfully running in it.
Step-4: Now creating a database named mydb in that sql instance to connect this database with our wordpress site.
Step-5: Now in our kubernetes cluster, installing wordpress which will get the wordpress from the wordpress image from hub.docker.com.
Step-6: Now creating replicas of our PODS so that whenever the load increases, it gets distributed over them so that our worpress site never goes down.
Step-7: Now creating external load balancer to handle the load if multiple hits are done on our site.
We got the ip of load balancer as 126.96.36.199, so we will give this ip to the client and client will hit this ip. As soon as the client hits this ip, the load balancer will automatically redirects the client to the PODS.
Now the last step is to connecting database to the wordpress, as in the image below we can see that the wordpress site is successfully running.
4. Connecting wordpress to our database
Step-1: Setting up the database which we wish to connect to our wordpress site. For this first entering the database name as mydb which we created(attached in above screenshots). Then placing username, password and ip address of the database which we wish to connect to our wordpress site.
That’s all. We have sucessfullly established the connectivity to our database!!!!
Now, just login to wordpress to use the services.
Hence, We can use our own wordpress.
We can also confirm our database connectivity by checking that the database which we created, are tables automatically created in that database or not.
In this project we first created vpc peering then launched kubernetes cluster with load balancer and in that cluster launched our own site and connecting it to database.
In this two-day workshop We learnt a lot about google cloud platform and also about how to use its various services. It improved our technical knowledge and various skills in the field of Cloud Computing.
Overall this was a Fabulous experience learning under Mr. Vimal Daga Sir.
Connect with us on LinkedIn: