CONTAINER ORCHESTRATION WITH SWARM MODE, MESOS/MARATHON AND - - PowerPoint PPT Presentation

container orchestration
SMART_READER_LITE
LIVE PREVIEW

CONTAINER ORCHESTRATION WITH SWARM MODE, MESOS/MARATHON AND - - PowerPoint PPT Presentation

CONTAINER ORCHESTRATION WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES ADRIAN MOUAT WHO AM I? Chief Scientist at Container Solutions Wrote "Using Docker" for O'Reilly 40% discount with code AUTHD Docker Captain @adrianmouat WHAT


slide-1
SLIDE 1

CONTAINER ORCHESTRATION

WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES ADRIAN MOUAT

slide-2
SLIDE 2

WHO AM I?

Chief Scientist at Container Solutions Wrote "Using Docker" for O'Reilly 40% discount with code AUTHD Docker Captain @adrianmouat

slide-3
SLIDE 3

WHAT IS ORCHESTRATION?

Oxford English Dictionary "The planning or coordination of the elements

  • f a situation to produce a desired effect,

especially surreptitiously"

slide-4
SLIDE 4

"The planning or coordination of the elements

  • f a situation to produce a desired effect,

especially surreptitiously"

slide-5
SLIDE 5

ELEMENTS

Containers Hosts Networking

slide-6
SLIDE 6

"The planning or coordination of the elements

  • f a situation to produce a desired effect,

especially surreptitiously"

slide-7
SLIDE 7

DESIRED EFFECT

Running application Automatically scale Fault tolerant failover, node rebalancing, health checks Use resources efficiently Little manual intervention

slide-8
SLIDE 8

"The planning or coordination of the elements

  • f a situation to produce a desired effect,

especially surreptitiously"

slide-9
SLIDE 9

SURREPTITIOUSLY

Oxford English Dictionary "In a way that attempts to avoid notice or attention; secretively"

slide-10
SLIDE 10

SURREPTITIOUSLY

Should happen in the background User doesn't need to details Complexity is hidden

slide-11
SLIDE 11

HOW IMPORTANT IS ORCHESTRATION?

Might not need it for small apps No orchestration == manual orchestration Manually place containers, network, scale, check, update

slide-12
SLIDE 12

COMPARING ORCHESTRATORS

slide-13
SLIDE 13

COMPARING ORCHESTRATORS

All work and are improving rapidly Understand the differences Understand your requirements Please don't roll your own!

slide-14
SLIDE 14

THE PLAYERS

Kubernetes Mesos Docker Swarm Mode Plus others Nomad, PaaSs...

slide-15
SLIDE 15

SIDE NOTE - THE BORG/OMEGA PAPERS

Influential papers from Google Lessons learnt from 10 years with containers Both high-level and technical reports Kubernetes, Docker Swarm and Nomad

slide-16
SLIDE 16

WELCOME TO THE SOCK SHOP!

slide-17
SLIDE 17

MICROSERVICE REFERENCE APPLICATION

Intended to help people get started with microservices Great for comparing frameworks etc Similar to "Pet Store" for Java ... or TodoMVC for JavaScript

slide-18
SLIDE 18

LOTS OF IMPLEMENTATIONS ALREADY

https://github.com/microservices-demo/microservices- demo/tree/master/deploy

slide-19
SLIDE 19

ARCHITECTURE

slide-20
SLIDE 20

DEMO

slide-21
SLIDE 21

DOCKER SWARM MODE

slide-22
SLIDE 22

SWARM MODE

New in Docker 1.12 Docker Inc's official solution Part of core distribution Major improvement over old Swarm

slide-23
SLIDE 23

CORE COMPONENTS

Manager nodes coordinate via Raft no need for separate etcd/zookeeper Worker nodes

slide-24
SLIDE 24

SNAP TO INSTALL

$ docker swarm init Swarm initialized: current node (ejgr3igiwu7mdvescuncyfq19) is now a manager. T

  • add a worker to this swarm, run the following command:

docker swarm join \

  • -token SWMTKN-1-5cubmn41arycoxa2hk4iu6gmauzafros4vhvnq8ftp0cuacn2u-2jxkuoimbzzoow00wuyxhf1mo \

10.34.9.126:2377 T

  • add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
slide-25
SLIDE 25

SECURE COMMS BY DEFAULT

TLS set up using self-signed certs Certificates automatically rotated

slide-26
SLIDE 26

OTHER FEATURES

Spread scheduling chooses "least loaded" node more options later support for reserving & limiting cpu/mem Global or Replica mode "Mesh Networking"

slide-27
SLIDE 27

CONSTRAINTS AND FILTERS

Control which node a container can be scheduled on E.g: Only nodes labeled "staging" Only nodes which have the image Only the node running a given container

slide-28
SLIDE 28

RUNNING SOCK SHOP

(note the repo currently needs updated in-line with version shown in talk) https://raw.githubusercontent.com/microservices- demo/microservices-demo/master/deploy/swarmkit/start- swarmkit-services.sh

slide-29
SLIDE 29

SWARM MODE ADVANTAGES

Snap to install Secure by default Bundled with Docker

slide-30
SLIDE 30

SWARM MODE DISADVANTAGES

New Some Docker features unsupported DAB still WIP No concept of Pods

slide-31
SLIDE 31
slide-32
SLIDE 32

MESOS

Predates Docker Used by large companies Twitter, Airbnb, eBay ... Mixed load Run Hadoop jobs next to Docker etc

slide-33
SLIDE 33

CORE COMPONENTS

Containerizer Mesos Agents Mesos Master ZooKeeper Frameworks

slide-34
SLIDE 34

CONTAINERIZER

Responsible for running isolated process In our case a Docker image Either use Docker or internal runtime

slide-35
SLIDE 35

SIDENOTE - CONTAINER RUNTIMES

Both Mesos and Kubernetes moving away from Docker Mesos to its own runtime K8s becoming "runtime agnostic" in reality rkt or runc You probably shouldn't care As long as it can run Docker/OCI images Developers will still use Docker

slide-36
SLIDE 36

MESOS AGENTS

Runs on nodes responsible for executing tasks Submit available resources to master

slide-37
SLIDE 37

MESOS MASTER

Sends tasks to agents Offers resources to frameworks

slide-38
SLIDE 38

ZOOKEEPER

Distributed HA database Used primarily for keeping track of current master

slide-39
SLIDE 39

FRAMEWORKS

Coordinate with master to schedule tasks Multiple frameworks available Can be run together Marathon, Aurora, Chronos, ElasticSearch

slide-40
SLIDE 40
slide-41
SLIDE 41

RUNNING SOCK SHOP

https://raw.githubusercontent.com/microservices- demo/microservices-demo/master/deploy/mesos- marathon/marathon.json

slide-42
SLIDE 42

MESOS ADVANTAGES

Battle-tested GUI Frameworks

slide-43
SLIDE 43

MESOS DISADVANTAGES

Needs 3rd party tools networking loadbalancing service discovery Marathon JSON could be cleaner

slide-44
SLIDE 44

KUBERNETES

slide-45
SLIDE 45

KUBERNETES

Based on Google's experience running containers Bakes in various features Load-balancing, secret management More opinionated

slide-46
SLIDE 46

CORE CONCEPTS

Pods Flat networking space Labels Services Deployments ReplicaSets

slide-47
SLIDE 47

PODS

Groups of containers deployed and scheduled together Atomic unit Containers in a pod share IP address Single container pods are common Pods are ephemeral

slide-48
SLIDE 48

FLAT NETWORKING SPACE

All pods are in the same network space Simple cross host communication

slide-49
SLIDE 49

LABELS

K/V pairs attached to objects (primarily pods) e.g: "version: dev", "tier: frontend" Label selectors then used to identify groups Used for load-balancing etc

slide-50
SLIDE 50

SERVICES

Stable endpoints addressed by name Forward traffic to pods Pods are selected by labels Round-robin load-balancing Separates endpoint from implementation

slide-51
SLIDE 51

DEPLOYMENTS & REPLICASETS

ReplicaSets monitor status of Pods start/stop pods as needed Deployments start ReplicaSets Rollout/Rollback & Updates

slide-52
SLIDE 52

RUNNING SOCK SHOP

https://github.com/microservices-demo/microservices- demo/blob/master/deploy/kubernetes/complete-demo.yaml

slide-53
SLIDE 53

KUBERNETES ADVANTAGES

Advanced features baked-in Lot of momentum behind the community

slide-54
SLIDE 54

KUBERNETES DISADVANTAGES

Harder to get started Extra concepts

slide-55
SLIDE 55

OTHER CONSIDERATIONS

Persistent Data Volumes Secrets Auto-scaling Multi-tenancy Health checks Updates and maintenance Images and platform Federation

slide-56
SLIDE 56

CONCLUSIONS

Different options with different strengths In some ways surprisingly similar Hard to predict a winner All are much better than rolling-your-own

slide-57
SLIDE 57

Swarm Mode Easy to deploy Secure by default WIP Mesos/Marathon Battle-tested Lacks some features Frameworks

slide-58
SLIDE 58

Kubernetes Lot of momentum Advanced features

slide-59
SLIDE 59

REFERENCES

Google Papers Sock Shop Reference Application TNS Article on Sock Shop Large-scale cluster management at Google with Borg (2015) Omega flexible, scalable schedulers for large compute clusters (2013) Borg, Omega, and Kubernetes (2016)