Integrating Docker with Mesos and Marathon

Post on 23-Jan-2018

675 views 6 download

Transcript of Integrating Docker with Mesos and Marathon

Rishabh Chaudhary

Integrating Docker with Mesos

and Marathon

2

Introduction to Mesos

Distributed System's Kernel

Cluster Manager

Master-slave architecture

3

Features of Mesos:

Scalability

Fault tolerance

Multi resource scheduling

GUI

Fine grained resource sharing

Supports docker containers

4

Architecture

MASTER 3

SLAVE 1 SLAVE 2 SLAVE 3 SLAVE 4

MASTER 1 MASTER 2

ZOOKEEPER

5

Introduction to Marathon

Application Scheduler

Cluster wide process supervisor

Scaling

Long running applications

Tolerant towards application failover

6

How do they work together?

7

Multi system environment:

8

Marathon: Features

HA: how?

Run multiple instances

Automatic selection of leader

Requests to non-leader gets redirected to the leader

Run other frameworks through Marathon

REST API and GUI

9

Architecture : Revised 1

MASTER 3

SLAVE 1 SLAVE 2 SLAVE 3 SLAVE 4

MASTER 1 MASTER 2

ZOOKEEPERMARATHON

SCHEDULER 2

10

Architecture : Revised 2

MASTER 3

SLAVE 1 SLAVE 2 SLAVE 3 SLAVE 4

MASTER 1 MASTER 2

ZOOKEEPERMARATHON

SCHEDULER 1

MARATHON

SCHEDULER 2

11

The list goes on..

12

Docker with Mesos and Marathon

Mesos supports containers:

Mesos Containers

Docker Containers

Long Running Tasks on Marathon

JSON Scripts

Marathon’s REST API

13

Points to note:

Not all tasks must be containerized

Non containerized tasks are also supported in Marathon

Tasks that should be run within a docker container must be configured to do so:

Use JSON scripts for task configuration

Use Marathon’s REST API to post the containerized application

14

Sample JSON:

{

"container": {

"type": "DOCKER",

"docker": {

"image": "autoscale",

"network": "BRIDGE"

}

},

"id": "relay",

"instances": 1,

"cpus": 0.5,

"mem": 512,

"uris": []

}

15

Sample JSON 2:{

"container": {

"type": "DOCKER",

"docker": {

"image": "loadcheck",

"network": "BRIDGE",

"portMappings": [

{ "containerPort":8080, "hostPort":0}

]

}

},

"env": {

"HOST_IP":"172.16.12.247:3306"

},

"id": "webapp",

"instances": 1,

"cpus": 0.5,

"mem": 512,

"cmd": "./bin/startup.sh && tail -f ./logs/catalina.out"

}

16

Tomcat

Server 1

Tomcat

Server 2

Tomcat

Server N

Load

BalancerDatabaseClient

Deployment example:

17

Questions?