GCP Project to run a web App on top of K8S containing database in another region Using VPC peering.

GCP Project to run a web App on top of K8S containing database in another region Using VPC peering.

?? PROJECT DESCRIPTION :

1. Create multi projects with dev and prod

2. Create VPC network for dev project

3.Create VPC network for prod project

4. Connect both the VPC network with VPC peering

5. Create a Kubernetes Cluster in dev project and launch a wordpress/Joomla application with the Load balancer

6. Create a SQL server in prod project and create a database

7. Connect the SQL database with the application launched in the K8s cluster.

Before doing any practical we have to know some basic knowledge about that technology , so that anyone can admire our knowledge & thought process. So first we have to know about the what is the google cloud platform why do we use it ?

What is Google Cloud Platform ( GCP ) ?

Google Cloud is a suite of Cloud Computing services offered by Google. The platform provides various services like compute, storage, networking, Big Data , and many more that run on the same infrastructure that Google uses internally for its end users like Google Search and YouTube.

Google server hasn’t gone down in years. So, if you are planning to run your application on the Google Cloud infrastructure, then you can be assured of your applications being safe and secure.

Why Google Cloud?

Google Cloud has been one of the top cloud providers in the IT industry. The services they offer can be accessed by software developers, as it provides a reliable and highly scalable infrastructure to build, test, and deploy their applications.

Best Pricing: Google Cloud hosting plans are cheaper than other platforms’ hosting plans. Google Cloud offers to its customers the pay-as-you-go feature where the users only have to pay for the resources they use.

Work from Anywhere: Employees gain complete access to information across devices from anywhere in the world through web-based applications powered by Google.

Private Network: Google provides its own network to every customer so that they have more control and scalability over the network. It uses fiber-optic cables to spread its network, as they tend to bear any amount of traffic. Users get maximum time and efficiency due to this private network.

Security: Google has hired a large set of security professionals who help in protecting the data on servers. All data on the Cloud platform is encrypted. So, users can be sure of their data being safe and secure.

Redundant Backup: Google has its own in-built redundant backups. So, if the data stored by the user is lost, then Google would have created a backup for it. So, your data is technically not lost! Redundancy helps ensure data integrity, reliability, and durability.

So here i want to discuss about the some services provide by the GCP that will used by me to performing this task. So the services are followings:

→ Compute Services:

  • Compute Engine: Infrastructure as a Service to run Microsoft Windows and Linux Virtual Machine. It is a component of the Google Cloud platform which is built on the same infrastructure that runs Google’s search engine, YouTube, and other services.
  • Kubernetes Engine: It aims at providing a platform for automating deployment, scaling, and operations of application containers across clusters of hosts. It works with a wide range of container tools including docker.

→ Storage Services

  • Google Cloud Storage: An online file storage web service for storing and accessing data on a Google Cloud platform infrastructure. The service combines the performance and scalability of Google Cloud with advanced security and sharing capabilities.
  • Cloud SQL: A web service that allows you to create, configure, and use relational databases that live in Google Cloud. It maintains, manages, and administers your databases allowing you to focus on your applications and services.

→ Networking

  • VPC: Virtual Private Cloud provides a private network with IP allocation, routing, and network firewall policies to create a secure environment for your deployments.
  • Cloud Load Balancing: It is a process of distributing workloads across multiple computing resources. This reduces the cost and maximizes the availability of the resources.

So while doing this we need the kubernetes services provide the deploy our wordpress pods , so we have to know some basic concepts of the kubernetes.

What is Kubernetes ?

Kubernetes is an open-source system that allows organizations to deploy and manage containerized applications like platforms as a service (PaaS), batch processing workers, and micro services in the cloud at scale. Through an abstraction layer created on top of a group of hosts, development teams can let Kubernetes manage a host of functions — including load balancing, monitoring, deployment , providing the storage and controlling resource consumption by team or application, limiting resource consumption and leveraging additional resources from new hosts added to a cluster, and other workflows.

We can use kubernetes on our local system as well as on the top of cloud also . So in this task we are using the cloud to deploy our app or website on it.

?? PROJECT COMPLETION :

This project is based on deployment of WordPress application using Integration of Google Cloud Platform and Kubernetes by Google Kubernetes Engine .

So , Lets start building these real use case based cloud architecture ?

Google Cloud Platform ?

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.

1) For building any kind of Infrastructure on Google Cloud Platform we have to build it under a project . So, I created two projects named as mydev91 and mypro91 for development and production .

We Can do this by using command gcloud projects create <project-name> in terminal or by using GUI.
No alt text provided for this image

After successful execution of command u will see the following projects in project list.

No alt text provided for this image

Now it's time to Create VPC network for both the projects. You can create VPC network with the GUI as well as CMD. I am using GUI here.

No alt text provided for this image

Similarly you can create network for production project. I used asia-east1 region in my-dev91 and us-central1 in my-pro91 project.

Now Lets peer that two networks from two different regions.

For peering You can go to VPC Network peering tab of VPC network. And enter the information in following manner.

No alt text provided for this image

Similarly you have to repeat the above steps for production project my-pro91 to activate peering. After successful execution of above steps you will show a following peered connection.

No alt text provided for this image

Half of the practical completed. Now It's time to launch our web application using kubernetes.

First we will launch a kubernetes cluster by using GUI then launch a wordpress pod using CLI.

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

After clicking the create button our container will created and ready to use or deploy pods in it.

No alt text provided for this image

After successful creation of the cluster. When you will click on connect button you will see the above command to copy. When you run the above command in CLI you will get access to the container.

Now run the following commands in CLI to launch a wordpress container and expose it to the internet.

No alt text provided for this image


Pod containing wordpress is launched. Now let's connect the wordpress pods to the database. For that go to production project and create a "SQL DATABASE" using GUI or CLI. As I used GUI for maximum time in this project , I'll stick to GUI for this project.

Guys choose the right region and network while deploying database, otherwise lots of complication can be occur.

Finally one more step ahead from completing our task.

Lastly let's connect our database to wordpress.

And Now our website is being launched. Here is the look of admin panel of our website.

Hence the task Is being completed under the guidance of Mr, Vimal daga sir.

Thank you for reading this whole Article.


要查看或添加评论,请登录

社区洞察

其他会员也浏览了