Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

banner

Three-tier web application with Google Kubernetes Engine (GKE)

Introduction

This architecture uses click-to-deploy so you can spin up infrastructure in minutes using terraform!

In the world of modern web development, it is essential to create scalable and reliable applications. To achieve this, a three-tier architecture has become a popular approach. This architectural pattern divides an application into three distinct layers: presentation, business logic, and data storage. Each layer has its own set of responsibilities, allowing for flexibility, maintainability, and efficient resource utilization.

This solution focuses on the combination of GKE clusters, which allows for automatic scaling as needed, Cloud SQL as a relational database, Cloud Storage for unstructured data, and Memorystore for caching, which reduces database access on frequent queries. This solution provides a powerful and robust infrastructure for hosting a three-tier web application.

Use cases

These are some examples of the use cases you can build on top of this architecture:

  • E-commerce Platform : Build a robust e-commerce platform where the presentation layer handles the user interface and shopping cart functionality. The business logic layer manages inventory, order processing, and payment integration.

  • Content Management System (CMS) : Create a scalable CMS where the presentation layer handles content creation, editing, and publishing. The business logic layer manages user authentication, access controls, and content organization. Cloud SQL for MySQL stores content metadata, user profiles, and settings, while Cloud Storage stores media files, such as images and videos.

  • Analytics Dashboard : Develop an analytics dashboard where users can visualize and explore data insights. The presentation layer provides interactive data visualizations and filtering options. The business logic layer handles data processing, aggregation, and query optimization.

Some common use examples include Cloud SQL for MySQL storing product catalogs, customer profiles, and transactional data, while Cloud Storage securely stores product images and other media assets.

Architecture

The main components that we would be setting up are (to learn more about these products, click on the hyperlinks)

  • VPC : Global virtual network that spans all regions. Single VPC for an entire organization, isolated within projects. Increase IP space with no downtime.
  • GKE : The most scalable and fully automated Kubernetes service
  • Cloud SQL for MySQL : Fully managed relational database service for MySQL, PostgreSQL, and SQL Server with rich extension collections, configuration flags, and developer ecosystems.
  • Cloud Storage (GCS) bucket : Cloud Storage is a managed service for storing unstructured data. Store any amount of data and retrieve it as often as you like.

Costs

Pricing Estimates - We have created a sample estimate based on some usage we see from new startups looking to scale. This estimate would give you an idea of how much this deployment would essentially cost per month at this scale and you extend it to the scale you further prefer. Here's the link.

Deploy the architecture

🕐 Estimated deployment time: 12 min

  1. Click on Open in Google Cloud Shell button below.
Open in Cloud Shell
  1. Run the prerequisites script to enable APIs and set Cloud Build permissions.
sh prereq.sh
  1. Run the Cloud Build Job
gcloud builds submit . --config build/cloudbuild.yaml

Testing the architecture

After you deployed the solution, you can check the resources created and see how they work together.

First, go to Google Kubernetes Engine and click on the created Cluster.

GKE

You can see all the details of you applications in Worloads menu

Workloads

Lastly,go to Cloud LoadBalancing and click on the frontend Load Balancer

loadbalancer

You can see all the details of the Load Balancer, and you can copy the Frontend IP section to access the application.

details

Finally, if you paste the ip and enter in your browser, you see the example application

template

Cleaning up your environment

Execute the command below on Cloud Shell to delete the resources.

gcloud builds submit . --config build/cloudbuild_destroy.yaml

This is not an official Google product.