Hands-on experience over GCP
GCP (Google Cloud platform) is a google product. Where it gives the facility to use the google data center.This is the same DC where google implement its own services like youtube, google search engine. Hence, here our application runs along with google services.
We require OS, RAM, storage to run our application. For this we need IT infrastructure . But now a days companies don’t want to invest over upfront. So we have some companies that provide services, they work on model: pay-as -you-go. And we outsource these services from such service providers as these companies are specialized in IT infrastructure management. The technology they use for providing services is Cloud Computing.
Here, I want to solve a use-case using the Google cloud Infrastructure, where we can deploy our application ( WordPress ) in a region where our target customers belong and storing data in our region due to compliance issue.
In GCP we have to create a project first to start using any resources. By default they create a project for us. As normally in a organization work on certain teams who work on different stages to launch a product.And each team has its own environment and we can set different quotas and billing accounts, limits etc. And in google these teams are known as Projects.Projects are just for management purposes as it is a great way to manage resources. And it provides isolation to each team and we can provide multiple access(this is managed by IAM) .
After creating a project you need to set up billing accounts in that project to continue using its resources inside the project.
In GCP, for every service google has an API , so that we can connect from outside world, and to use the particular service or resource first we have to enable that API.
GCP offers Networking as a Service through VPC. It is a great way to manage our environment as we can customize everything from IP address to region on our according. This is a virtual network which we define.
Creating the VPC for our WordPress web-app in US(zone: us-east1):
Now ,creating the VPC for the database environment in Singapore.(asia-southeast1)
If we have two independent VPCs the only way to connect is through Public Network, but we can also use Google Private Network to connect . To connect both the VPCs we have to do the VPC peering from both the VPCs.
GCP instances can use Internal IP to connect to other instances in GCP using google private network. Which is more secure, less costly and reduces latency and delay.
Now creating a VPC -peering:
But this created peering is inactive as both the VPCs need to do the peering to establish a private network between them.
Hence,creating the vpc-peering again from another vpc to establish the connection.
GCP gives us 4 ways to connect to this API:
- Web UI/console
- -CLI: using gcloud command -Activating cloud shell: without using our own base OS, we work on CLI and run the gloud commands over there. This facility is unique to GCP only, we dont get such facility in AWS.
- SDK (software development kit)
Follows the way to install Google Cloud SDK to get gcloud command on our CLI:
GCP gives Kubernetes as a service through Google kubernetes engine (GKE) product where we get a fully managed master (which has high availability) ,And we just have to give configurations for slave nodes and the whole cluster is managed by service provider.
In GKE there are two types of clusters: (Master node is fully managed so its not our look out where is gets launched)
- Zonal cluster: All the slave nodes are launched at a single zone/ data center. It is better in terms of speed, but lacks in terms of disaster recovery.
- Regional cluster: The node pools are launched at different data center/ zone of a particular region. (Node pools tells the specification of nodes per zone). It is better in terms of disaster recovery and lacks little bit in terms of speed.
So, here we will launch our web application : WordPress at GKE in wp-vpc which is in US, so that our clients that belongs to that region can easily connect with no delay and also GKE will provide no downtime with maximum availability.
Now, Your cluster is created. Now to connect to your cluster we need to download kubectl command in our CLI. Kubectl helps to connect to your master node and give commands to furthur use the cluster resources.
Now, we need a Database to store the data of our web-app.In GCP, for database as a a service to store information in rows and columns we have SQL. It gives us a fully managed database.
Here, I used SQL to create the database.
GCP gives its independent service of load balancing that is LB (load balancer) . Kubernetes cluster internally use this external load balancer to expose the pods in the cluster and also manages ingress traffic.
And now using the external IP of our load balancer we can connect to our application and its data will be stored in the Database instance we created.
All these concepts In GCP , was the outcome of just 2 days Workshop under Mr.Vimal Daga. Thankyou so much !!