unit-get and LXC containers
Andreas Hasenack
andreas at canonical.com
Tue Jul 23 18:37:00 UTC 2013
Hi,
I was playing with LXC containers and co-location using juju-core trunk and
found out that "unit-get private-address" returns the IP of the unit's
host, not of the container.
I know that the container IP is only unique in the context of that host,
since another container in another unit could get the same IP.
On the other hand, returning the unit's IP does not mean that the service
can be reached, since it's listening on the LXC interface.
So basically, unit-get private-address doesn't mean much in the case of
containers. You cannot connect to that IP and expect the service that is
running in the container to respond.
For example, if you want to play with the wordpress charm using just one
unit, you could try with having two wordpress containers in that unit and
haproxy and mysql on the unit itself. But that won't work, because haproxy
will get this configuration:
listen haproxy_service 0.0.0.0:80
balance leastconn
server 10_55_63_201__8080 10.55.63.201:8080 maxconn 100
server 10_55_63_201__8080 10.55.63.201:8080 maxconn 100
That IP is the address of the unit, not the container.
In this *particular* case, using the LXC IP would have worked, because it's
known to the unit. But as soon as you add another machine with another
wordpress running inside it as a container, and link to this haproxy, it
will break.
Was there any discussion about this? It means there has to be careful
planing about what to deploy inside containers inside existing units.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju/attachments/20130723/73818c1f/attachment-0001.html>
More information about the Juju
mailing list