[ 
https://issues.apache.org/jira/browse/MESOS-5702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15350797#comment-15350797
 ] 

Philip Winder edited comment on MESOS-5702 at 6/27/16 11:11 AM:
----------------------------------------------------------------

Confirmed. The issue was that the cni bridge plugin wasn't installed. The 
documentation isn't explicit enough. I'll try and make a PR.

For future reference, I got everything working with the following:

{code}
# Make dirs if they don't exist
sudo mkdir -p /opt/cni/bin
sudo mkdir -p /etc/cni/net.d

# Add location of binary and conf directories for CNI.
echo '/opt/cni/bin' | sudo tee /etc/mesos-slave/network_cni_plugins_dir
echo '/etc/cni/net.d' | sudo tee /etc/mesos-slave/network_cni_config_dir

# Add example Mesos CNI plugin configuration
echo '{
"name": "cni-test",
"type": "bridge",
"bridge": "mesos-cni0",
"isGateway": true,
"ipMasq": true,
"ipam": {
    "type": "host-local",
    "subnet": "192.168.0.0/16",
    "routes": [
    { "dst":
      "0.0.0.0/0" }
    ]
  }
}' | sudo tee /etc/cni/net.d/bridge.conf


# Install go:
sudo curl -O https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz
sudo tar -xvf go1.6.linux-amd64.tar.gz
sudo mv go /usr/local
export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME

# Install CNI plugins
git clone https://github.com/containernetworking/cni.git
cd cni
git checkout v0.3.0
./build
sudo cp bin/* /opt/cni/bin

{code}

Then to create a service to ping, try this:

{code}
 # Start a container to ping. It will only be pingable from the same host.
 sudo mesos-execute --command='ifconfig ; sleep 9999999' 
--docker_image=amouat/network-utils --master=$MASTER:5050 --name=pingme 
--networks=cni-test
 # Then log on to the machine that the task was started. E.g. if it started on 
S0, log onto SLAVE0. Then you can:
 ping 192.168.0.2 # Or whatever IP it started on.
 # When in bridge mode, the container connects to an internal network local to 
that host. Hence, the pinger must run on the same machine as the pingme. So 
restart as many times as necessary to get it running on the same host.
 # Get the ip address from the first container.
 sudo mesos-execute --command='ifconfig && ping -v -c 1 192.168.0.2 && sleep 
99999' --docker_image=amouat/network-utils --master=$MASTER:5050 --name=pinger 
--networks=cni-test
{code}


was (Author: philwinder):
Confirmed. The issue was that the cni bridge plugin wasn't installed. The 
documentation isn't explicit enough. I'll try and make a PR.

For future reference, I got everything working with the following:

{code}
# Make dirs if they don't exist
sudo mkdir -p /opt/cni/bin
sudo mkdir -p /etc/cni/net.d

# Add location of binary and conf directories for CNI.
echo '/opt/cni/bin' | sudo tee /etc/mesos-slave/network_cni_plugins_dir
echo '/etc/cni/net.d' | sudo tee /etc/mesos-slave/network_cni_config_dir

# Add example Mesos CNI plugin configuration
echo '{
"name": "cni-test",
"type": "bridge",
"bridge": "mesos-cni0",
"isGateway": true,
"ipMasq": true,
"ipam": {
    "type": "host-local",
    "subnet": "192.168.0.0/16",
    "routes": [
    { "dst":
      "0.0.0.0/0" }
    ]
  }
}' | sudo tee /etc/cni/net.d/bridge.conf


# Install go:
sudo curl -O https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz
sudo tar -xvf go1.6.linux-amd64.tar.gz
sudo mv go /usr/local
export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME

# Install CNI plugins
git clone https://github.com/containernetworking/cni.git
cd cni
git checkout v0.3.0
./build
sudo cp bin/* /opt/cni/bin

{code}

Then to create a service to ping, try this:

{code}
 # Start a container to ping. It will only be pingable from the same host.
 sudo mesos-execute --command='ifconfig ; sleep 9999999' 
--docker_image=amouat/network-utils 
--master=ec2-52-16-230-26.eu-west-1.compute.amazonaws.com:5050 --name=pingme 
--networks=cni-test
 # Then log on to the machine that the task was started. E.g. if it started on 
S0, log onto SLAVE0. Then you can:
 ping 192.168.0.2 # Or whatever IP it started on.
 # When in bridge mode, the container connects to an internal network local to 
that host. Hence, the pinger must run on the same machine as the pingme. So 
restart as many times as necessary to get it running on the same host.
 # Get the ip address from the first container.
 sudo mesos-execute --command='ifconfig && ping -v -c 1 192.168.0.2 && sleep 
99999' --docker_image=amouat/network-utils 
--master=ec2-52-16-230-26.eu-west-1.compute.amazonaws.com:5050 --name=pinger 
--networks=cni-test
{code}

> CNI documentation example is not explicit enough about external plugins
> -----------------------------------------------------------------------
>
>                 Key: MESOS-5702
>                 URL: https://issues.apache.org/jira/browse/MESOS-5702
>             Project: Mesos
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>            Reporter: Philip Winder
>
> I'm testing Mesos 1.0.0-rc1 with Weave CNI. When I switched back to the CNI 
> example stated in the docs and restarted mesos-slave, I received a strange 
> error about not being able to find hadoop.
> I think that it's related to this issue: 
> https://issues.apache.org/jira/browse/MESOS-5669
> I thought I'd log the issue, but if it has been fixed by the issue above, 
> feel free to close.
> The setup, state and logs can be found here: 
> https://gist.github.com/philwinder/8f4c652723fa5c374b86a5e440bf4330



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to