Microservices Learn, Build and Deploy a simple application

Post on 21-Apr-2022

3 views 0 download

Transcript of Microservices Learn, Build and Deploy a simple application

Microservices

Learn, Build and Deploy a simple application

Rajini Karthik & Surya Naredla

Dell EMC

What is a Microservice?

A software design pattern

A collection of small autonomous services, modelled around a business domain

Loosely coupled, independently deployable unit of code

Separates business functions

Communicate via well-defined APIs usually HTTPs

Discoverable through some form of service discovery

Dell EMC 2

Monolithic SOA Microservices

Monolithic vs SOA vs Microservices

Dell EMC 3

Why Microservices?

Challenges of Monolithic Architecture

Limited - Limitations due to size and complexity of the system

Flexibility – Cannot mix technologies and cannot adopt new technologies

Reliability – Any change or bug will impact the whole system as they are tightly coupled

Scalability – Applications cannot be scaled easily based on individual features due to resource requirements

Development - Development takes time

Continuous Development – Multiple features cannot be built and deployed continuously and independently

Dell EMC 4

Monolithic vs Microservices

User Interface

Business Logic

Data Layer

Monolithic Architecture

User Interface

Microservice

Microservices Architecture

MicroserviceMicroservice Microservice

Microservice

Message

Bus

Dell EMC 5

Microservices Features

Agile Development

Component Based

Business Centric

AutonomousContinuous

Delivery

Flexibility

Microservices

Loose Coupling

Dell EMC 6

Pros & Cons of MicroservicesP

ros •Development

Flexibility

•Deployment Flexibility

• Service Isolation

• Technology Stack

• Component Based Scaling

Co

ns • Planning

• Cost

• Component Integration

• Over Engineering

• Others• Eg- Troubleshooting,

performance, code-sharing

Dell EMC 7

Microservices on Containers vs. VMs

• Low Cost• For example OS License Cost

• Performance and Efficiency• CPU overhead

• Reduced Size• Container are smaller than VMs

• Faster Execution• Creation time

Dell EMC 8

Microservices Architecture Considerations

• Design - API Gateway, Data Storage

• Scalability - Autoscaling

• Availability - Resource Constraints

• Security - Pod and Container Security

• Deployment (CI/CD) - Independent Deployment, updates and upgrades etc...

Dell EMC 9

Container Orchestrators

Dell EMC 10

Dell EMC 11

KubernetesOverview

Dell EMC 12

Why Kubernetes?

Supports microservices architecture through the

service objects

Deployment, scaling and management of containerized

applications and services

Dell EMC 13

1. Cluster - Network of containers2. Nodes - Machines on which a cluster

runs. Can be master or node3. Pod - A group of one or more

containers4. Service - an abstraction which defines a

logical set of Pods and a policy to access them

5. ReplicaSet - Ensures a given number of pods are running and available in the cluster at a given time

6. Deployment - descriptor of the desired state on creating and updating instances

Kubernetes Terminology

7. Kubectl - CLI tool for interacting with the Kubernetes cluster

8. Volume - sometimes-shared, persistent storage

9. Master - Control plane entity responsible for managing the cluster (API Server, Scheduler, etcd (key-value store), controller-manager)

10. Node - Worker machine or VM in the cluster ( kube-proxy, kubelet, container Runtime)

1. Namespace - Namespaces organize services within the cluster

7. StatefulSets - Maintain the state of applications beyond an individual pod lifecycle, such as storage

Dell EMC 14

Kubernetes Architecture

API server

Controller Manager

Scheduler

etcd

Master

Worker Node1

Pod Pod Pod...

Pod

Kubelet Kube-Proxy

Worker NodeN

Pod Pod PodPod

Kubelet Kube-Proxy

......

Users/Clients

CLI/UI

Container Runtime Container RuntimeDell EMC 15

Kubernetes – Services and Pods

Reference: Microservices architecture on Azure Kubernetes Service from https://docs.microsoft.com/en-us/azure/architecture/reference-architectures/microservices/aks

Dell EMC 16

• PersistantVolume (PV) – Administrator

provisioned volumes, a virtual storage instance pointing to physical storage

• PersistantVolumeClaim (PVC) - A request

for storage. PVCs consumes PVs

Kubernetes – Storage Primitives

Physical Storage

Persistent Volume (PV)

Persistent Volume Claim (PVC)

Microservice App/pod

Dell EMC 17

Kubernetes Service Providers

Minikube

An open-source tool that you can install in your local

machine to use Kubernetes locally.

Google Kubernetes Engine (GKE)

Google's solution that manages production-ready Kubernetes

clusters

Amazon Elastic Kubernetes Service (EKS)

Amazon's solution that manages production-ready Kubernetes

clusters

Azure Kubernetes Service (AKS)

Microsoft's solution that provides you managed,

production-ready Kubernetes clusters.

OpenShift Kubernetes

Red Hat's solution that handles Kubernetes clusters for you

Dell EMC 18

Minikube

MNode

Master

Container Runtime

VM

$kubectl

Dell EMC 19

Demo Application

Dell EMC 20

Application Architecture

Users Microservice

Tasks Microservice

Client Browser

MongoDB Service

Dell EMC 21

Lab LogisticsGitHub:https://github.com/rajinir/microservices-kubernetes-sample

Login:Use the ssh private key in the Github, login into the

instance provided to you using a ssh terminal ( putty etc..)https://github.com/rajinir/microservices-kubernetes-sample/tree/master/setup/id_rsa

Dell EMC 22

Lab Section1Instance, SSH and Setup

Dell EMC 23

Lab Section2.Deploy Minikube and Kubectl

Dell EMC 24

Lab Section3Minikube and KubeCtl

Dell EMC 25

Lab Section4Deploy MongoDB Pod

Dell EMC 26

Lab Section5Deploy Users-Tasks Sample Application

Dell EMC 27

Lab Section6Test the application

Dell EMC 28

Ecosystem Tools• Prometheus - A monitoring solution for Kubernetes cluster• Istio - A tool that supports service deployment in kubernetes. It is used for connecting,

monitoring and securing microservices

References•https://www.microservices.com•https://microservices.io/•https://kubernetes.io/•https://docs.docker.com/engine/reference/builder/•http://eventuate.io/exampleapps.html

Tools & References

Dell EMC 29

Thank you

Contacts• IRC: rajinir• Email: rajini_karthik@dell.com• Email: surya_prabhakar@dell.com