-
Notifications
You must be signed in to change notification settings - Fork 673
automatic IP assigment #22
Comments
Are you suggesting something DHCP-like handled within the weave network? Or DHCP proper? I think you mean the former, but it's not clear (because actually it might only be DHCP-like in the sense that it allocates addresses, right?). Following on from that, do you envisage a distributed algorithm for address allocations, or an approach based on a particular weaver being designated as the address server? |
I am not suggesting anything yet :) Haven't thought about it enough. |
You could run a DNS service, so users didn't have to remember IP addresses. Let them specify a symbolic name for each container within the weave network. |
We have plans around DNS. DNS doesn't help us solve this problem here - having to specify a name and MAC when starting a container is just as bad as having to specify an IP and MAC. |
Whatever we call this service, feature-wise it should include:
This service could bind with weave through an optional parameter |
I also feel there is a need for a DHCP-like service so weave start commands can get a collision-safe IP for each new container that is started. The resolution of a "service" to this IP address should be left to an external service like etcd as @yaronr said. The main question here I suppose is where this DHCP is going to be. Leaving it on an arbitrary host will be a single point of failure, unless it is a distributed service on all nodes. |
Have you considered using some service like etcd/consul? or maybe integrating Raft directly in the application? I don't see DHCP as a possible solution here: it would probably require installing DHCP clients and, as @khash mentioned, it would be a SPF. So a distributed DHCP server would have to be implemented, maybe by using Raft, maybe by adding a etcd/consul backend to an existing server (a not so bad idea)... A service like this could also have some other benefits. For example, it could be used for service discovery (by capturing and inspecting DNS requests and answering them), reduce ARP traffic (by capturing and inspecting ARP requests and answering them), load balancing, etc... |
We just hacked together a solution using etcd and cas. Every time we deploy a new container, we do a cas on a key in etcd to get a new ip address and cache it for later re-use. Here's the python code if anybody finds it useful:
You should initialize the counter with We're looking at very slow growth here so I don't expect to overflow (hence the overflow exception and really lazy implementation of skipping .0, .1, and .255 addresses). We're also rolling this out slowly so we won't know how well it scales for some time. We also automatically re-attempt this at a higher level, you might want to add some retry logic in case there's another service starting at the same time. |
Nice short solution, thanks. We are hoping to implement with much lower overhead than etcd; currently investigating gossip-based schemes. I'll put a link here to the requirements doc I drew up for debate. |
#485 related. |
It is a chore to have to specify a CIDR whenever starting a container with weave. DHCP to the rescue. Or something like that. Arguably DHCP is the wrong way round. We want to go from a name/domain to an IP in a particular subnet.
Note that as well as for application containers, we also need IP addresses for the weave container and weavedns, though we could defer that to a separate issue.
The text was updated successfully, but these errors were encountered: