Jfokus 2017 - Experiences from using discovery services in a ...

15
| CALLISTAENTERPRISE.SE JFOKUS 2017 – EXPERIENCES FROM USING DISCOVERY SERVICES IN A MICROSERVICE LANDSCAPE MAGNUS LARSSON 2017-02-07

Transcript of Jfokus 2017 - Experiences from using discovery services in a ...

Page 1: Jfokus 2017 - Experiences from using discovery services in a ...

| CALLISTAENTERPRISE.SE

JFOKUS 2017 – EXPERIENCES FROM

USING DISCOVERY SERVICES IN A

MICROSERVICE LANDSCAPEMAGNUS LARSSON

2017-02-07

Page 2: Jfokus 2017 - Experiences from using discovery services in a ...

WHAT CONTAINER ORCHESTRATION TOOL TO USE?

• Google Kubernetes, Docker Swarm, Amazon ECS…- Can we change orchestration tool, without require code changes?

USE MICROSERVICES WITH OR WITHOUT CONTAINERS?

2

MICROSERVICES WITHOUT CONTAINERS?

• Can we start without containers and migrate later on?- Without require code changes?

Page 3: Jfokus 2017 - Experiences from using discovery services in a ...

• Write once, deploy “everywhere”?- Only require configuration changes!

• Selected platforms:- Without containers using Netflix Eureka for Service Discovery- Container orchestration tools (built in Service Discovery):

» Google Kubernetes» Docker Swarm mode » Amazon ECS – EC2 Container Services

MY PERSONAL QUEST FOR 2016

3

Main challengeHow to write code that works with the variousService Discovery implementations?

Page 4: Jfokus 2017 - Experiences from using discovery services in a ...

EXAMPLE #1 – SPRING CLOUD AND NETFLIX OSS (NO CONTAINERS)

4

Web Browser

Quotes #1 Quotes #2

Discovery Server #1

(NetflixEureka)

Portal

localhost

Test landscape

1. Verify load balancing

2. Kill one of the quote service instances…

3. …or a discoveryservice…

4. Start it again…

Discovery Server #2

(NetflixEureka)

Page 5: Jfokus 2017 - Experiences from using discovery services in a ...

Master NodeMaster Node(s)

EXAMPLE #2: DOCKER SWARM MODE

Docker Services and Routing Mesh

5

SwarmLoad

Balancer

B

Orchestrator

B-2 B-3B-1

Worker Node #1 Worker Node #2B B

• 2016-07-28: Docker 1.12 released

• A service is accessible internalusing a DNS name with a static IP address

• A service is accessible externally from all nodes one and the same port

Page 6: Jfokus 2017 - Experiences from using discovery services in a ...

EXAMPLE #2: DOCKER SWARM MODE

6

Tests

1. Same tests as for Netflix Eureka

2. Test Resilience- Kill quote container- Kill node with containers

- Verify that containers are rescheduled automatically!

Page 7: Jfokus 2017 - Experiences from using discovery services in a ...

Master Node

Master Node

EXAMPLE #3: KUBERNETES

Kubernetes Services

7

B

Control Plane

Kube-proxy

B-2 B-3B-1

Work Node #1 Work Node #2B B

Kubelet

• A service is accessible internalusing a DNS name with a static IP address

• A service is accessible externally from all nodes one and the same port

Page 8: Jfokus 2017 - Experiences from using discovery services in a ...

EXAMPLE #3: KUBERNETES

8

Tests

• Setup a Kubernetes Cluster in Google Cloud- With auto scaling of both pods (e.g. containers) and nodes

• Same tests as for Docker Swarm

• Test auto scaling!

Page 9: Jfokus 2017 - Experiences from using discovery services in a ...

EXAMPLE #3: KUBERNETES

9

• Put some load using the portal and wait for a while…• Any new pods and nodes?

$ kubectl get podsNAME READY STATUS RESTARTS AGEquotes-4029858897-2nsm6 1/1 Running 0 2mquotes-4029858897-5xn93 1/1 Running 0 17mquotes-4029858897-82vdc 1/1 Running 0 6mquotes-4029858897-d5ctp 1/1 Running 0 6mquotes-4029858897-s6sl4 0/1 Pending 0 2mquotes-4029858897-w8crj 0/1 Pending 0 2m

$ kubectl get nodesNAME STATUS AGEkubernetes-master Ready,SchedulingDisabled 21mkubernetes-minion-group-4ptj Ready 22mkubernetes-minion-group-l6kv NotReady 6skubernetes-minion-group-xq6d Ready 18m

Page 10: Jfokus 2017 - Experiences from using discovery services in a ...

Amazon ECS

EXAMPLE #4: AMAZON ECS

ECS = EC2 Container Services

10

AmazonApplication

LoadBalancer

B

Orchestrator

B-2 B-3B-1

EC2 instance #1 EC2 instance #2

B B

Amazon ECS container agent

Amazon ECS• 2016-08-11: Amazon Application Load Balancer• Extend Amazon ELB to support ECS

Page 11: Jfokus 2017 - Experiences from using discovery services in a ...

EXAMPLE #4: AMAZON ECS

11

Tests

• Setup a Amazon ECS Cluster with Application Load Balancer

• Same tests as for Kubernetes in Google Cloud

Page 12: Jfokus 2017 - Experiences from using discovery services in a ...

AMAZON APPLICATION LOAD BALANCER WITH PATH BASED ROUTING

12

Page 13: Jfokus 2017 - Experiences from using discovery services in a ...

• Blog series – Building microservices:http://callistaenterprise.se/blogg/teknik/2015/05/20/blog-series-building-microservices/

• Workshop in developing microservices-Build a set of collaborating microservices from ground up

using Spring Boot, Spring Cloud, Netflix OSS and Docker.- Jfokus – 2017-02-06- jDays – 2017-03-09

IF YOU WANT TO LEARN MORE…

13

Page 14: Jfokus 2017 - Experiences from using discovery services in a ...

• Mission accomplished, worked to write once and deployed on:- Without containers using Netflix Eureka as Discovery Service- Container orchestration tools (with built in Discovery Service):

» Google Kubernetes» Docker Swarm mode» Amazon ECS

• Only differs in configuration• Prevents vendor lock in• Platform specific features can be used, e.g. auto scaling in the cloud• Can be accomplished using any language, not only Java

SUMMARY

14

Page 15: Jfokus 2017 - Experiences from using discovery services in a ...

15

?