Lxd launch remote


#1

Hi,
I’m trying to understand how launching new containers works, there’s something that I’m missing here.
I’ve 2 ubuntu servers 18.04 with latest lxc/lxd from repository.
I’m trying to create containers from the host I choose to be the master, choosing each time which remote to use.
But the remote I set is ignored for what appears to be round robin, is this a setting somewhere? I coundn’t find it.
Thanks

root@lxd0:~# ifconfig enp0s3
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.20.1.134  netmask 255.255.255.0  broadcast 172.20.1.255
        inet6 fe80::a00:27ff:fee7:e238  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:e7:e2:38  txqueuelen 1000  (Ethernet)
        RX packets 1022430  bytes 214592516 (214.5 MB)
        RX errors 0  dropped 2178  overruns 0  frame 0
        TX packets 1302884  bytes 285327871 (285.3 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@lxd0:~# lxc remote list
+-----------------+------------------------------------------+---------------+-----------+--------+--------+
|      NAME       |                   URL                    |   PROTOCOL    | AUTH TYPE | PUBLIC | STATIC |
+-----------------+------------------------------------------+---------------+-----------+--------+--------+
| images          | https://images.linuxcontainers.org       | simplestreams |           | YES    | NO     |
+-----------------+------------------------------------------+---------------+-----------+--------+--------+
| local (default) | unix://                                  | lxd           | tls       | NO     | YES    |
+-----------------+------------------------------------------+---------------+-----------+--------+--------+
| lxd1            | https://172.20.1.131:8443                | lxd           | tls       | NO     | NO     |
+-----------------+------------------------------------------+---------------+-----------+--------+--------+
| ubuntu          | https://cloud-images.ubuntu.com/releases | simplestreams |           | YES    | YES    |
+-----------------+------------------------------------------+---------------+-----------+--------+--------+
| ubuntu-daily    | https://cloud-images.ubuntu.com/daily    | simplestreams |           | YES    | YES    |
+-----------------+------------------------------------------+---------------+-----------+--------+--------+
root@lxd0:~# lxc launch images:centos/7 c7-001
Creating c7-001
Starting c7-001
root@lxd0:~# lxc launch images:centos/7 c7-002
Creating c7-002
Starting c7-002
root@lxd0:~# lxc launch images:centos/7 c7-003
Creating c7-003
Starting c7-003
root@lxd0:~# lxc launch images:centos/7 lxd1:c7-004
Creating c7-004
Starting c7-004
root@lxd0:~# lxc launch images:centos/7 lxd1:c7-005
Creating c7-005
Starting c7-005
root@lxd0:~# lxc launch images:centos/7 lxd1:c7-006
Creating c7-006
Starting c7-006
root@lxd0:~# lxc launch images:centos/7 c7-007
Creating c7-007
Starting c7-007
root@lxd0:~# lxc launch images:centos/7 c7-008
Creating c7-008
Starting c7-008
root@lxd0:~# lxc launch images:centos/7 c7-009
Creating c7-009
Starting c7-009
root@lxd0:~# lxc list
+--------+---------+------+------+------------+-----------+----------+
|  NAME  |  STATE  | IPV4 | IPV6 |    TYPE    | SNAPSHOTS | LOCATION |
+--------+---------+------+------+------------+-----------+----------+
| c7-001 | STOPPED |      |      | PERSISTENT | 0         | lxd0     |
+--------+---------+------+------+------------+-----------+----------+
| c7-002 | STOPPED |      |      | PERSISTENT | 0         | lxd1     |
+--------+---------+------+------+------------+-----------+----------+
| c7-003 | STOPPED |      |      | PERSISTENT | 0         | lxd0     |
+--------+---------+------+------+------------+-----------+----------+
| c7-004 | STOPPED |      |      | PERSISTENT | 0         | lxd1     |
+--------+---------+------+------+------------+-----------+----------+
| c7-005 | STOPPED |      |      | PERSISTENT | 0         | lxd0     |
+--------+---------+------+------+------------+-----------+----------+
| c7-006 | STOPPED |      |      | PERSISTENT | 0         | lxd1     |
+--------+---------+------+------+------------+-----------+----------+
| c7-007 | STOPPED |      |      | PERSISTENT | 0         | lxd0     |
+--------+---------+------+------+------------+-----------+----------+
| c7-008 | STOPPED |      |      | PERSISTENT | 0         | lxd1     |
+--------+---------+------+------+------------+-----------+----------+
| c7-009 | STOPPED |      |      | PERSISTENT | 0         | lxd0     |
+--------+---------+------+------+------------+-----------+----------+

(Stéphane Graber) #2

When using LXD clustering, you should only have a single remote pointing to any of the cluster nodes.

You can then make placement requests within the cluster with:

lxc launch images:centos/7 --target c7-006

Multiple remotes in your case should only really be used if you have multiple clusters, in such a case, you’d then use the remote to tell LXD what cluster to send the request to, then use --target to tell that LXD cluster what node you’d like the container to be on.


#3

Thanks again, it’s all clear now…