Mesos install using Google Cloud Platform
Create consul instances
docker-machine create \
--driver google \
--google-project $PROJECT \
--google-zone asia-east1-c \
--google-machine-type f1-micro mh-keystore
docker $(docker-machine config mh-keystore) run -d \
-p "8500:8500" \
-h "consul" progrium/consul \
-server -bootstrap
create swarm master
docker-machine create \
--driver google \
--google-project $PROJECT \
--google-zone asia-east1-c \
--google-machine-type n1-standard-1 \
--swarm --swarm-master \
--swarm-discovery="consul://$(docker-machine ip mh-keystore):8500" \
--engine-opt="cluster-store=consul://$(docker-machine ip mh-keystore):8500" \
--engine-opt="cluster-advertise=eth0:2376" \
mhs-demo0
create swarm slave
docker-machine create \
--driver google \
--google-project $PROJECT \
--google-zone asia-east1-c \
--google-machine-type n1-standard-1 \
--swarm \
--swarm-discovery="consul://$(docker-machine ip mh-keystore):8500" \
--engine-opt="cluster-store=consul://$(docker-machine ip mh-keystore):8500" \
--engine-opt="cluster-advertise=eth0:2376" \
mhs-demo1
Mesos compose configuration file
File: mesos-marathon-swarm.yml
zookeeper:
image: garland/zookeeper
container_name: zookeeper
ports:
- "2181:2181"
- "2888:2888"
- "3888:3888"
environment:
- "constraint:node==mhs-demo0"
mesosmaster:
image: mesosphere/mesos-master:0.25.0-0.2.70.ubuntu1404
container_name: mesosmaster
ports:
- "5050:5050"
environment:
- MESOS_ZK=zk://zookeeper:2181/mesos
- MESOS_LOG_DIR=/var/log/mesos
- MESOS_QUORUM=1
- MESOS_REGISTRY=in_memory
- MESOS_WORK_DIR=/var/lib/mesos
- "constraint:node==mhs-demo0"
marathon:
image: mesosphere/marathon
container_name: marathon
command: --master zk://zookeeper:2181/mesos --zk zk://zookeeper:2181/marathon
ports:
- "8080:8080"
environment:
- "constraint:node==mhs-demo0"
mesosslave:
image: mesoscloud/mesos-slave
# no container name because then mesosslaves can't be scaled
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup
- /var/run/docker.sock:/var/run/docker.sock
ports:
- "5051:5051"
privileged: true
environment:
- MESOS_MASTER=zk://zookeeper:2181/mesos
- MESOS_LOG_DIR=/var/log/mesos
- MESOS_LOGGING_LEVEL=INFO
- MESOS_CONTAINERIZERS=docker
- "affinity:container!=*zookeeper*"
- "affinity:container!=*mesosslave*"
Create swarm related services
eval $(docker-machine env --swarm mhs-demo0)
docker-compose --x-networking \
--x-network-driver=overlay \
-f mesos-marathon-swarm.yml up -d
Others (k8s)
docker-compose --x-networking \
--x-network-driver=overlay \
-f k8s/k8s-swarm.yml up -d
docker-compose -f k8s/k8s-swarm.yml up -d
docker-compose --x-networking --x-network-driver=overlay -f k8s/k8s-swarm.yml scale kubelet=3
kubectl -s 107.167.179.185:32768 run mypods \
--image=peihsinsu/mvm-nodejs-webcapture \
--labels=role=u2b
curl -X POST http://10.141.141.10:8080/v2/apps -d @basic-3.json -H "Content-type: application/json"
curl -X POST http://10.141.141.10:8080/v2/apps -d @basic-3.json -H "Content-type: application/json"