Application deployment onto clustered lxd results in unpredictable placement
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Canonical Juju |
Incomplete
|
Low
|
Joseph Phillips |
Bug Description
I'm deploying on top of maas provider into lxc containers.
Latest juju snap 2.8.1 13324 with agents also matching version; maas 2.8.1-8567-
I have deployed ubuntu on 4 nodes and then installed latest snap lxd (4.3, 16100) onto them, and went through the clustering configuration (lxd init).
Once that's done I've deployed a bundle with the following placement:
machines:
"0":
"1":
"2":
applications:
ceph-mon:
...
to:
- lxd:0
ceph-osd:
...
to:
- lxd:0
- lxd:1
- lxd:2
This has resulted in the following container list:
root@edge2-4:~# lxc list
+------
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | LOCATION |
+------
| juju-410afd-0-lxd-0 | RUNNING | 192.168.30.208 (eth0) | | CONTAINER | 0 | edge2-1 |
| | | 172.40.2.8 (eth1) | | | | |
+------
| juju-410afd-0-lxd-1 | RUNNING | 192.168.30.209 (eth0) | | CONTAINER | 0 | edge2-4 |
| | | 172.40.3.8 (eth2) | | | | |
| | | 172.40.2.9 (eth1) | | | | |
+------
| juju-410afd-3-lxd-1 | RUNNING | 192.168.30.210 (eth0) | | CONTAINER | 0 | edge2-1 |
| | | 172.40.3.9 (eth2) | | | | |
| | | 172.40.2.10 (eth1) | | | | |
+------
| juju-410afd-3-lxd-2 | RUNNING | 192.168.30.211 (eth0) | | CONTAINER | 0 | edge2-2 |
| | | 172.40.3.10 (eth2) | | | | |
| | | 172.40.2.11 (eth1) | | | | |
+------
Notice that eg both 0-lxd-0 and 3-lxd-1 landed on edge2-1 (edge2-1 got machine number 0, edge2-2 is machine 1, edge2-4 is machine 3).
Also 3-lxd-1 and 3-lxd-2 are on separate machines.
This is due to the default lxd cluster behavior, where it spreads the containers evenly on the hosting nodes. It can be overridden by supplying the --target to the lxc create command during container creation time.
The only workaround I have found is to move the containers after their deployment is complete:
root@edge2-1:~# lxc stop juju-410afd-3-lxd-2
root@edge2-1:~# lxc move juju-410afd-3-lxd-2 --target edge2-4
But this could be done by juju during container deployment time.
Changed in juju: | |
assignee: | nobody → Joseph Phillips (manadart) |
Hi Gábor.
From what you have described, you are *not* using a LXD cloud, but rather a MAAS cloud on which you have set up a LXD cluster.
The LXD provider does support container placement - we treat each server as an availability zone, so you can use the --to syntax to force where a container goes. But this is not the same as local container management on physical nodes, which does not reason about clustering.
You have two options.
1. After setting up the cluster, add it to the same controller as another cloud, so you can deploy containers on to the machines you want.
2. Simply don't use clustering. By default Juju gets container addresses from MAAS when you deploy something to lxd:x. All the containers should be able to access each other and they end up on the exact node you specify.
I would favour option 2, as it is the simplest.
The main question here is, what are you hoping to gain by using a cluster in this way?