Code Monkey home page Code Monkey logo

contiv-mesos's Introduction

For vagrant demo, try https://github.com/contiv/netplugin/tree/master/vagrant/mesos-cni

####Pre-requisites

CentOS 7.x machines with 2 network interfaces.
ansible setup to configure cluster.
Passwordless ssh to machines

###Step 1 Download files

mkdir -p some_dir && cd some_dir
wget https://raw.githubusercontent.com/contiv/demo/master/mesos/download.sh
./download.sh

###Step 2 Create inventory file

create ansible "inventory" file
follow example file inventory.example 

###Step 3 Execute playbook

./setup.sh 

Example: bring-up vagrant cluster of 5 nodes & configure mesos/marathon with contiv

# bring up vagrant nodes
vagrant up

# update passwordless ssh to vagrant nodes
SSHKEY=$(vagrant ssh-config | grep IdentityFile | head -n1 | awk -F' ' '{ print $2 }')
ssh [email protected] -i ${SSHKEY}

# crate inventory
cp inventory.example inventory

# execute ansible playbook 
SSHKEY=$(vagrant ssh-config | grep IdentityFile | head -n1 | awk -F' ' '{ print $2 }')
./setup.sh -u vagrant  --private-key=${SSHKEY}

###Step 4 Launch containers

use "cni_task.sh" script to launch containers.
wget https://raw.githubusercontent.com/contiv/netplugin/master/vagrant/mesos-cni/cni_task.sh

This script creates contiv tenant/network.

usage: ./cni_task.sh [-m marathon-ipaddr] [-j jobname] [-t tenant-name] [-n network-name] [-g network-group] [-s subnet]
-m marathon-ipaddr : 192.168.2.10:5050 is by default
-j jobname         : "container.xxx" by default
-t tenant-name     : "default" by default
-n network-name    : "default-net" by default
-s subnet          : "10.36.28.0/24" by default

# create a python http server listening on port 9002 in contiv network 
'default-net'

./cni_task.sh 

to launch containers without using cni_task.sh, create network using netctl cli

$ netctl net create default-net -subnet 10.1.1.0/24

create a json file & update the following fields with apropriate value
id : <uniqe id>
io.contiv.tenant :<name of contiv tenant name>
io.contiv.network : <name of contiv network name>
io.contiv.net-group : <name of contiv network group>

{
  "id": "container1",
  "cmd": "python -m SimpleHTTPServer 9002",
  "cpus": 1,
  "mem": 500,
  "disk": 0,
  "instances": 1,
  "container": {
    "type": "MESOS",
    "volumes": [],
    "mesos": {
      "image": "ubuntu:14.04",
      "privileged": false,
      "parameters": [],
      "forcePullImage": false
    }
  },
  "ipAddress": {
     "networkName": "netcontiv",
     "labels": {
         "io.contiv.tenant": <name of contiv tenant name>
         "io.contiv.network": <name of contiv network name>
         "io.contiv.net-group": <name of contiv network group> 
     }

 }
}
launch the containers by sending json configutaion to marathon
curl -X POST http://192.168.2.10:8080/v2/apps -d @${JSON_FILE} \
     -H "Content-type: application/json"

###Step 5 Check mesos/marathon mesos ui master:5050 marathon ui master:8080

  • mesos runs in HA mode,
  • marathon runs on the first master node

contiv-mesos's People

Contributors

rchirakk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.