Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Macvlan network support in Rancher cattle #8686
I have updated network-manager, it can be able to support other CNI drivers. So macvlan network support can be achieved. #8535
By the customer's communication, there are two main scenarios using macvlan. One is "Inner Gateway Mode", another is "External Gateway Mode", if names are not good please forgive me.
Basically, most users are looking forward to the first mode, because there is no need to transform their network too much. We bring about the first mode, if some people need second mode, the transformation will be very easy.
For catalog item:
I want to use macvlan driver to attach containers on Internet routable IP addresses and at the same time avoid Internet traffic to reach the host itself. For that purpose I resort on L2 VLAN separation, thus having a dedicated public vlan interface on the host (no IP address on the host public interface though).
Couple of questions:
I'm in the "second mode"/"external gateway" mode.
I have containers, that I want to be on the rancher network (
Let's assume options of mitigation (load-balancing, service-discovery, SNI forwarding) have been exhausted, I'm not trying to diagnose WHY one would use this in one's environment, just grant the premise that one does. Static NATs, mac-address pinning, tight ACLs; whatever the reason.
In this scenario,
Currently, this is very easily do-able in a non-rancher environment. but not scalable/managable in rancher.
Can you link the containers purposefully within Rancher so you don't have to waste another IP per Host for a docker0 gateway?
Or even the use of sidekick containers (yes, 1 per) may be preferable over using another IPv4 address on the main subnet (which may not be yours to hand out).
Hi, for me I solved this issue by pipework script. Just create global service:
version: '2' services: pipework: privileged: true image: dreamcat4/pipework environment: host_routes: 'true' route_add_delay: '1' run_mode: batch,daemon network_mode: host volumes: - /var/run/docker.sock:/docker.sock pid: host labels: io.rancher.scheduler.global: 'true'
After it, you can run other containers and specify any custom network settings for it by simple adding environment variable to it, example:
version: '2' services: test: image: ubuntu:14.04.3 environment: pipework_cmd: br0 @CONTAINER_NAME@ email@example.com
After starting, the new interface will be added into your container, which connected to bridge br0, and the ip 10.36.60.9/16 will be assigned to it, default gateway will be changed to 10.36.0.1.
More examples here:
libnetwork with docker 1.10+
Would be great if rancher server could support the docker network features native?