Google Cloud Platform: GCP

Google Cloud Platform: 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 Youtube. Alongside a set of management tools, it provides a series of modular cloud services including computing, data storage, data analytics and machine learning. Google Cloud Platform is a part of Google Cloud, which includes the Google Cloud Platform public cloud infrastructure, as well as G Suite, enterprise versions of Android and Chrome OS , and Application Programming Interfaces(APIs) for Machine Learning and enterprise mapping services.

Kubernetes is a portable, extensible, open-source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation. It has a large, rapidly growing ecosystem. Kubernetes services, support, and tools are widely available.

Regions are collections of zones. Zones have high-bandwidth, low-latency network connections to other zones in the same region. In order to deploy fault-tolerant applications that have high availability, Google recommends deploying applications across multiple zones and multiple regions.

ABOUT THE TASK:-

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

Solution:-

No alt text provided for this image

Create the VPC:

For creating the VPC we have to go to the Networking section and where you have to choose VPC network. Now fill the details.We have to create 2 VPC, One for kubernetes cluster and second for database.

VPC (For Kubernetes):

Here I have created a VPC named wp-vpc in us-central1 region with an IP address of 10.0.2.0/24.

No alt text provided for this image

VPC (For Database):

Here I have created a VPC named db-vpc in asia-southest1 region with an IP address of 10.0.0.0/24.

No alt text provided for this image

When we create the VPC we will see that VPC is created with specific ip address range.

Create VPC peering:

VPC peering is a network connection between two VPCs that allows traffic routing between the VPCs.

For creating the VPC peering go to VPC Network Peering under VPC Network.

VPC peering (For Wordpress): Fill the following details in it.

No alt text provided for this image

VPC peering (For Database): Fill the following details in it.

No alt text provided for this image


After creating this we can see there are two VPC peering created and both are in their active state.

No alt text provided for this image

Launch kubernetes cluster for wordpress:

For every service provided by the GCP , there is an API provided to connect to it.We can connect to the API either through the WebUI or through the CLI provided by the GCP or through Google cloud SDK.

Here I have used Google SDK. So we have to install Google SDK after installation this SDK we can use gcloud command in our local command prompt.

Also we have to install kubectl command for using kubernetes cluster which allows us to access our remote kubernetes cluster from our local system.

you can download kubectl command from this link:

https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/windows/amd64/kubectl.exe

For creating Kubernetes cluster, GCP provides a service named Google Kubernetes Engine under compute services.Fill the detail in it.

I have created my cluster with the name cluster-1 in us-central1 region.

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

After creating the cluster we can see that our cluster with the name cluster-1 has been created.

No alt text provided for this image
No alt text provided for this image

Creating wordpress deployment:

After the creation of cluster we need to deploy our wordpress pod on the nodes. This process can be done through our local system command prompt.

First of all we need to connect to the cluster created inside our project on GCP. For that we need to use the following command and We can also see the nodes running on our cluster through the following command.

Now check the config view of the cluster

Now check from WebUI that instance and load balancer is successfuly created and an external IP has been created which can be given to our clients to access the wordpress.

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Create the MySql instance:

For creating mysql instance we have to go in the storage section then go to sql option and now fill the detail in it.

No alt text provided for this image
No alt text provided for this image

After creating this we can see our instance is created.

No alt text provided for this image

Creating the user and a database:

Now we have to create a user to access our database.Here I have created a user named n and set the password of it redhat.

No alt text provided for this image

We have to create the database. I created a database named worddb.

No alt text provided for this image
No alt text provided for this image

Now launch the wordpress by copying the External IP address provided by the load balancer and paste it on our browser.

Now we have to give the database credentials which we set at the time of MySql instance launching.

No alt text provided for this image

Finally I deploy wordpress on the top of kubernetes cluster on GCP successfully.



To view or add a comment, sign in

More articles by Anadi Gupta

Others also viewed

Explore content categories