Hyper: Swarm on Mesos

2015-11-21 Klaus Ma 更多博文 » 博客 » GitHub »

原文链接 http://www.k8s.tips/tech/2015/11/21/swarm_mesos_integration/

Swarm on Mesos Overview


  1. Swarm API gets REST API request, and then create a task and put it into message queue.
  2. Swarm Cluster (registered as Mesos framework) gets offer from Mesos
  3. Swarm Cluster picks up a task from message queue
  4. Swarm Cluster calls Scheduler’s routine to gets target host
  5. Swarm Cluster calls Mesos API to create Docker container in target host.
  6. Mesos master creates Docker container in Mesos cluster
  7. Mesos sends the container notification back to Swarm Cluster (planned after Mesos 0.23+, currently still replies on Swarm Cluster calling Docker API via Engine)
  8. Swarm Cluster update container into to task channel
  9. Swarm API gets result of request and then return as REST API result


Swarm on Mesos

Both Swarm manager & Mesos Slave will communicate with docker daemon: Swarm access Docker daemon through REST API, such as `docker ps; Mesos run docker image by docker command through unix domain socket. So the docker daemon in each node much accept tcp & unix domain socket as follow:

docker daemon -H tcp:// -H unix:///var/run/docker.sock


Each node in your swarm must run a Mesos slave. The slave must be capable of starting tasks in a Docker Container using the --containerizers=docker option. For example:

mesos-slave --containerizers=docker,mesos --master=zk://zknode:2181/mesos --isolation=cgroups

Swarm Manager

Start Swam cluster by following command:

swarm --debug manage -c mesos-experimental \
    --cluster-opt mesos.address= \
    --cluster-opt mesos.tasktimeout=10m \
    --cluster-opt mesos.user=root \
    --cluster-opt mesos.offertimeout=1m \
    --cluster-opt mesos.port=3375 --host zk://zhhost1:2181/mesos