...
https://github.com/apache/mesos/blob/master/docs/cni.md
Simple port mapping
In /etc/cni/net.d, create a bridge.conf and a portmapper.conf
Code Block | ||
---|---|---|
| ||
# cat /etc/cni/net.d/bridge.conf
{
"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" }
]
}
}
# cat /etc/cni/net.d/portmapper.conf
{
"name" : "port-mapper-test",
"type" : "mesos-cni-port-mapper",
"excludeDevices" : ["mesos-cni0"],
"chain": "MESOS-TEST-PORT-MAPPER",
"delegate": {
"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" }
]
}
}
}
|
In cni directory, put the following cni binaries: bridge ,host-local, mesos-cni-port-mapper
bridge and host-local come from cni: https://github.com/containernetworking/plugins/releases,
mesos-cni-port-mapper is included in mesos, just copy the binary in cni binaries directory.
In go-d.ini set mesos/port_mapper_network_name field to port-mapper-test
Weave
To access to the container (ssh or other open ports), Weave network must be exposed on the user gateway (via "weave expose").
...
Usual setup will be for isolation: filesystem/linux,docker/runtime,cgroups/cpu,cgroups/mem,network/cni
Test on mesos
...
Code Block | ||
---|---|---|
| ||
sudo mesos-execute --command="ifconfig && sleep 30" -docker_image=centos:latest --master=127.0.0.1:5050 --name=test0 --networks=calico-net-1 |
...