Cluster virtual IP


I have a 5 node LXD cluster and I would like to use a virtual IP for the cluster. The idea is this virtual ip will be used by remote lxc clients to connect to cluster and if a node is down the ip will move to a live host.
Currently it is not possible as the nodes have to listen on a particular IP for clustering to work properly. Even if a virtual ip is configured lxd doesn’t listen on it.

How can this be achieved?


In future releases we might do some work to make clustering networking more flexible for the control panel (rest API/clients). However, there’s nothing scheduled at the moment.

What we should probably do is to modify the Go lxc client library (and hence the lxc command line, based on it) to be cluster aware and automatically store the IPs of some cluster nodes, in case one of them goes down.

In the meantime, you could maybe setup a DNS hostname that round robins or fails over against your cluster IPs, and make clients use that host name.

@stgraber might have more practical suggestions

Indeed, there’s nothing that does this in LXD itself right now.
To support a VIP, we should be switching LXD to have both core.listen_address and cluster.listen_address, which would let you have LXD bind to a specific address for internal cluster communication while binding a different address (possibly [::]:8443) for normal client traffic.

Until we have this, I suspect your options are:

  • DNS round-robin
  • Use a VIP combined with local NAT, effectively having that VIP NAT traffic to the local IP that’s used by LXD