menu
arrow_back

Migrating a Monolithic Website to Microservices on Google Kubernetes Engine

Migrating a Monolithic Website to Microservices on Google Kubernetes Engine

1 Stunde 30 Minuten 7 Guthabenpunkte

GSP699

Google Cloud Self-Paced Labs

Introduction

Why migrate from a monolithic application to a microservices architecture? Breaking down an application into microservices has the following advantages, most of these stem from the fact that microservices are loosely coupled:

  • The microservices can be independently tested and deployed. The smaller the unit of deployment, the easier the deployment.
  • They can be implemented in different languages and frameworks. For each microservice, you're free to choose the best technology for its particular use case.
  • They can be managed by different teams. The boundary between microservices makes it easier to dedicate a team to one or several microservices.
  • By moving to microservices, you loosen the dependencies between the teams. Each team has to care only about the APIs of the microservices they are dependent on. The team doesn't need to think about how those microservices are implemented, about their release cycles, and so on.
  • You can more easily design for failure. By having clear boundaries between services, it's easier to determine what to do if a service is down.

Some of the disadvantages when compared to monoliths are:

  • Because a microservice-based app is a network of different services that often interact in ways that are not obvious, the overall complexity of the system tends to grow.
  • Unlike the internals of a monolith, microservices communicate over a network. In some circumstances, this can be seen as a security concern. Istio solves this problem by automatically encrypting the traffic between microservices.
  • It can be hard to achieve the same level of performance as with a monolithic approach because of latencies between services.
  • The behavior of your system isn't caused by a single service, but by many of them and by their interactions. Because of this, understanding how your system behaves in production (its observability) is harder. Istio is a solution to this problem as well.

In this lab you will deploy an existing monolithic application to a Google Kubernetes Engine cluster, then break it down into microservices. Kubernetes is a platform to manage, host, scale, and deploy containers. Containers are a portable way of packaging and running code. They are well suited to the microservices pattern, where each microservice can run in its own container.

Architecture Diagram of Our Microservices

Start by breaking the monolith into three microservices, one at a time. The microservices include, Orders, Products, and Frontend. Build a Docker image for each microservice using Cloud Build, then deploy and expose the microservices on Google Kubernetes Engine (GKE) with a Kubernetes service type LoadBalancer. You will do this for each service while simultaneously refactoring them out of the monolith. During the process you will have both the monolith and the microservices running until the very end when you are able to delete the monolith.

636a2d58588b2b87.png

What you'll learn

  • How to break down a Monolith to Microservices

  • How to create a Google Kubernetes Engine cluster

  • How to create a Docker image

  • How to deploy Docker images to Kubernetes

Prerequisites

  • A Google Cloud Platform account with administrative access to create projects or a project with Project Owner role

  • A basic understanding of Docker and Kubernetes

Wenn Sie sich in Qwiklabs anmelden, erhalten Sie Zugriff auf den Rest des Labs – und mehr!

  • Sie erhalten vorübergehenden Zugriff auf Google Cloud Console.
  • Mehr als 200 Labs für Einsteiger und Experten.
  • In kurze Sinneinheiten eingeteilt, damit Sie in Ihrem eigenen Tempo lernen können.
Beitreten, um dieses Lab zu starten
Punktzahl

—/100

Create a GKE Cluster

Schritt ausführen

/ 20

Deploy Existing Monolith

Schritt ausführen

/ 20

Migrate Orders to a microservice

Schritt ausführen

/ 20

Migrate Products to microservice

Schritt ausführen

/ 20

Migrate Frontend to microservice

Schritt ausführen

/ 20