LXD clustering - Single-node cluster or Convert standalone to cluster

Hi All,

I am in the process of deploying an LXD host and I am trying to future proof my deployment for growing out.

It seems to me that there may be 2 ways to go about this:

  1. Configure the LXD instance without clustering now and re-run lxd init if/when needed to convert to a cluster setup.
  2. Configure the LXD instance as a single-node cluster and the join other nodes if/when needed.

Questions:

  • Is the first approach even possible without loosing anything?
  • Are there any downsides to the second approach? It seems less risky come scaling time, but I would be introducing increased complexity.

Hi!

sudo lxd init (has to be with sudo otherwise you can get some weird errors) is a wizard that internally runs a set of configuration options.
It’s possible to perform all the tasks in sudo lxd init manually with lxc commands and some sudo commands (file-system creation, etc).
The idea is that you run sudo lxd init once, and then you go along with lxc commands.

Having said that, here is what you can do

  1. Set up LXD as normal without clustering since you do not need it now.

  2. When you do want to enable clustering, simply run

    $ lxc cluster enable mycluster
    Clustering enabled
    

See lxc cluster for the rest of the subcommands.

2 Likes

Thanks again for a thorough response Simos. Will do!

Just to be clear, lxc cluster enable my-node-name turns a non-clustered LXD instance into the first node of a LXD cluster without losing any data (since you asked specifically for that). Any additional node you want to add to the cluster must be completely empty tho.

2 Likes

Thanks for the clarification. That was what I expected.