microservices learn, build and deploy a simple application

30
Microservices Learn, Build and Deploy a simple application Rajini Karthik & Surya Naredla Dell EMC

Upload: others

Post on 21-Apr-2022

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Microservices Learn, Build and Deploy a simple application

Microservices

Learn, Build and Deploy a simple application

Rajini Karthik & Surya Naredla

Dell EMC

Page 2: Microservices Learn, Build and Deploy a simple application

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

Page 3: Microservices Learn, Build and Deploy a simple application

Monolithic SOA Microservices

Monolithic vs SOA vs Microservices

Dell EMC 3

Page 4: Microservices Learn, Build and Deploy a simple application

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

Page 5: Microservices Learn, Build and Deploy a simple application

Monolithic vs Microservices

User Interface

Business Logic

Data Layer

Monolithic Architecture

User Interface

Microservice

Microservices Architecture

MicroserviceMicroservice Microservice

Microservice

Message

Bus

Dell EMC 5

Page 6: Microservices Learn, Build and Deploy a simple application

Microservices Features

Agile Development

Component Based

Business Centric

AutonomousContinuous

Delivery

Flexibility

Microservices

Loose Coupling

Dell EMC 6

Page 7: Microservices Learn, Build and Deploy a simple application

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

Page 8: Microservices Learn, Build and Deploy a simple application

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

Page 9: Microservices Learn, Build and Deploy a simple application

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

Page 10: Microservices Learn, Build and Deploy a simple application

Container Orchestrators

Dell EMC 10

Page 11: Microservices Learn, Build and Deploy a simple application

Dell EMC 11

Page 12: Microservices Learn, Build and Deploy a simple application

KubernetesOverview

Dell EMC 12

Page 13: Microservices Learn, Build and Deploy a simple application

Why Kubernetes?

Supports microservices architecture through the

service objects

Deployment, scaling and management of containerized

applications and services

Dell EMC 13

Page 14: Microservices Learn, Build and Deploy a simple application

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

Page 15: Microservices Learn, Build and Deploy a simple application

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

Page 16: Microservices Learn, Build and Deploy a simple application

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

Page 17: Microservices Learn, Build and Deploy a simple application

• 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

Page 18: Microservices Learn, Build and Deploy a simple application

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

Page 19: Microservices Learn, Build and Deploy a simple application

Minikube

MNode

Master

Container Runtime

VM

$kubectl

Dell EMC 19

Page 20: Microservices Learn, Build and Deploy a simple application

Demo Application

Dell EMC 20

Page 21: Microservices Learn, Build and Deploy a simple application

Application Architecture

Users Microservice

Tasks Microservice

Client Browser

MongoDB Service

Dell EMC 21

Page 22: Microservices Learn, Build and Deploy a simple application

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

Page 23: Microservices Learn, Build and Deploy a simple application

Lab Section1Instance, SSH and Setup

Dell EMC 23

Page 24: Microservices Learn, Build and Deploy a simple application

Lab Section2.Deploy Minikube and Kubectl

Dell EMC 24

Page 25: Microservices Learn, Build and Deploy a simple application

Lab Section3Minikube and KubeCtl

Dell EMC 25

Page 26: Microservices Learn, Build and Deploy a simple application

Lab Section4Deploy MongoDB Pod

Dell EMC 26

Page 27: Microservices Learn, Build and Deploy a simple application

Lab Section5Deploy Users-Tasks Sample Application

Dell EMC 27

Page 28: Microservices Learn, Build and Deploy a simple application

Lab Section6Test the application

Dell EMC 28

Page 29: Microservices Learn, Build and Deploy a simple application

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

Page 30: Microservices Learn, Build and Deploy a simple application

Thank you

Contacts• IRC: rajinir• Email: [email protected]• Email: [email protected]